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