IO{R,W,RW}_BAD
PATCH 1/1 IO{R,W,RW}_BAD
We need this patch to compile some drivers. It's a mirror of the patch applied to i386 and other architectures.
Index: include/asm-ia64/ioctl.h
=================================RCS file: /var/cvs/linux-2.6/include/asm-ia64/ioctl.h,v retrieving revision 1.1
asm-ia64/ioctl.h +13 -3
@@ -54,11 +54,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) +/* used to create numbers */ #define _IO (type,nr) _IOC(_IOC_NONE,(type),(nr),0) -#define _IOR (type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) -#define _IOW (type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) -#define _IOWR (type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size)) +#define _IOR (type,nr,size) _IOC(_IOC_READ,(type),(nr),(_IOC_TYPECHECK(size))) +#define _IOW (type,nr,size) _IOC(_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) +#define _IOWR (type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),(_IOC_TYPECHECK(size))) +#define _IOR_BAD (type,nr,size) _IOC(_IOC_READ,(type),(nr),sizeof(size)) +#define _IOW_BAD (type,nr,size) _IOC(_IOC_WRITE,(type),(nr),sizeof(size)) +#define _IOWR_BAD (type,nr,size) _IOC(_IOC_READ|_IOC_WRITE,(type),(nr),sizeof(size))/* used to decode ioctl numbers.. */ #define _IOC_DIR (nr) (((nr) >> _IOC_DIRSHIFT) & _IOC_DIRMASK)
Signature · 3 lines
"It's not Hollywood. War is real, war is primarily not about defeat or victory, it is about death. I've seen thousands and thousands of dead bodies. Do you think I want to have an academic debate on this subject?" -- Robert Fisk
Quoted 10 lines · Matthew Wilcox
We need this patch to compile some drivers. It's a mirror of the patch applied to i386 and other architectures.
Index:
include/asm-ia64/ioctl.h
=================================> RCS file:/var/cvs/linux-2.6/include/asm-ia64/ioctl.h,vretrieving revision 1.1
diff -u -p -r1.1ioctl.h
asm-ia64/ioctl.h line 62
Quoted 9 lines
asm-ia64/ioctl.h +6
-0@@ -54,11 +54,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 needs to be implemented differently. Glibc needs to include this file for <sys/ioctl.h>, but the use of the undefined symbol will make it impossible to compile without optimisation.
Andreas.
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected] 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."