Messages in this thread | | | Date | Thu, 16 Sep 2004 01:10:01 +0100 | From | viro@parcelfa ... | Subject | Re: Being more careful about iospace accesses.. |
| |
On Wed, Sep 15, 2004 at 04:26:12PM -0700, Linus Torvalds wrote:
> other bitwise type. You'd get a warnign about incompatible types. Makes > sense, no? > - you can only do operations that are safe within that byte order. For > example, it is safe to do a bitwise "&" on two __le16 values. Clearly > the result is meaningful.
BTW, so far the most frequent class of endianness bugs had been along the lines of foo->le16_field = cpu_to_le32(12); and vice versa. On big-endian it's a guaranteed FUBAR - think carefully about the value that will end up there.
> Oh, btw, right now you only get the warnings from sparse if you use > "-Wbitwise" on the command line. Without that, sparse will ignore the > bitwise attribute.
We probably want __attribute__((opaque)) in addition to bitwise - e.g. for the handles of all sorts passed in network filesystem protocols. I'll look into that when we get the endianness warnings somewhat under control.
For now I'm going to #define __opaque __bitwise and use it for stuff like typedef __u32 __opaque cifs_fid; etc. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |