Re: PATCH: usb: descriptor structures have to be packed

Pete Zaitcev <[email protected]>
Newsgroups gmane.linux.usb.devel
Organization Red Hat, Inc.
Message-ID <[email protected]>
On Wed, 7 Feb 2007 21:26:36 +0100, Oliver Neukum <[email protected]> wrote:

> > It would not, if le16_to_cpu took a pointer to u8. But as it is,
> > functions are quite different.
> 
> That's what casts are for. However, why do you have no type information
> in the first place? Untyped data is risky.

You are right, the traditionalist way is weak in this regard.
And I saw people applying ntohs to a long and vice versa before.

However, don't you discard the typing as well whenever get_unaligned
is involved? The function itself is always sized correctly
with the use of typeof, but then it returns u64 and thus the
subsequent le16_to_cpu becomes unchecked. I think Alan was on to
something with his sized get_unaligned ideas.

-- Pete

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.