Jesse Keating 7a3296
diff -up vanilla-2.6.29-rc7-git2/arch/sparc/include/asm/ioctl.h.BAD vanilla-2.6.29-rc7-git2/arch/sparc/include/asm/ioctl.h
Jesse Keating 7a3296
--- vanilla-2.6.29-rc7-git2/arch/sparc/include/asm/ioctl.h.BAD	2009-03-09 17:01:32.000000000 -0400
Jesse Keating 7a3296
+++ vanilla-2.6.29-rc7-git2/arch/sparc/include/asm/ioctl.h	2009-03-09 16:52:27.000000000 -0400
Jesse Keating 7a3296
@@ -41,6 +41,17 @@
Jesse Keating 7a3296
          ((nr)   << _IOC_NRSHIFT) | \
Jesse Keating 7a3296
          ((size) << _IOC_SIZESHIFT))
Jesse Keating 7a3296
 
Jesse Keating 7a3296
+#ifdef __KERNEL__
Jesse Keating 7a3296
+/* provoke compile error for invalid uses of size argument */
Jesse Keating 7a3296
+extern unsigned int __invalid_size_argument_for_IOC;
Jesse Keating 7a3296
+#define _IOC_TYPECHECK(t) \
Jesse Keating 7a3296
+        ((sizeof(t) == sizeof(t[1]) && \
Jesse Keating 7a3296
+          sizeof(t) < (1 << _IOC_SIZEBITS)) ? \
Jesse Keating 7a3296
+          sizeof(t) : __invalid_size_argument_for_IOC)
Jesse Keating 7a3296
+#else
Jesse Keating 7a3296
+#define _IOC_TYPECHECK(t) (sizeof(t))
Jesse Keating 7a3296
+#endif
Jesse Keating 7a3296
+
Jesse Keating 7a3296
 #define _IO(type,nr)        _IOC(_IOC_NONE,(type),(nr),0)
Jesse Keating 7a3296
 #define _IOR(type,nr,size)  _IOC(_IOC_READ,(type),(nr),sizeof(size))
Jesse Keating 7a3296
 #define _IOW(type,nr,size)  _IOC(_IOC_WRITE,(type),(nr),sizeof(size))