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

From: Andreas Schwab
Date: Mon Sep 08 2003 - 08:41:32 EST


Arnd Bergmann <arnd@xxxxxxxx> writes:

> --- 1.1/include/asm-i386/ioctl.h Tue Feb 5 18:39:44 2002
> +++ edited/include/asm-i386/ioctl.h Mon Sep 8 13:21:28 2003
> @@ -52,11 +52,21 @@
> ((nr) << _IOC_NRSHIFT) | \
> ((size) << _IOC_SIZESHIFT))
>
> +/* provoke compile error for invalid uses of size argument */
> +extern int __invalid_size_argument_for_IOC;
> +#define _IOC_TYPECHECK(t) \
> + ((sizeof(t) == sizeof(t[1]) && \
> + sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
> + sizeof(t) : __invalid_size_argument_for_IOC)

This will fail when compiled unoptimized, which means that glibc could not
use <asm/ioctls.h> any more.

Andreas.

--
Andreas Schwab, SuSE Labs, schwab@xxxxxxx
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
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/