Re: [PATCH] use size_t for the broken ioctl numbers

From: Linus Torvalds
Date: Sun Sep 07 2003 - 18:22:43 EST



On Sun, 7 Sep 2003, Linus Torvalds wrote:
>
> On Sun, 7 Sep 2003, Arnd Bergmann wrote:
> >
> > How about changing (sizeof(x)) to (sizeof(x[1]))?
> > It will result in "parse error before `['" when x is not
> > a type or an array type.
>
> That sounds like a clever thing to do. Have you tested it with a full
> configuration?

In fact, what you'd want to do is not just verify that it compiles, but
also verify that the object code matches.

Because there _is_ one case where adding the [1] will still compile, but
generate wrong code: if the "size" argument to the _IOx() was not a type,
but a real actual array.

Now, that would have been a bug (or at least a misfeature) before too, but
the point of this whole thread was that some people used the _IOx() macros
incorrectly, so maybe such broken usage actually exists..

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/