summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2003-09-10 06:22:16 +1000
committerPaul Mackerras <paulus@samba.org>2003-09-10 06:22:16 +1000
commit8e85a4d907a4aaf5b33bac9688fb423204001f6a (patch)
treee6c534adb475393de1e1ce7d2b1b829513f43d17 /include
parent3e2adaf6c0bc9c23da70e1957d63bc1c644015e4 (diff)
parentabe68253c6df04d314a9099e5416a6c7881728e9 (diff)
Merge samba.org:/home/paulus/kernel/linux-2.5
into samba.org:/home/paulus/kernel/for-linus-ppc
Diffstat (limited to 'include')
-rw-r--r--include/asm-i386/ioctl.h16
-rw-r--r--include/sound/hdsp.h3
-rw-r--r--include/sound/sscape_ioctl.h4
3 files changed, 18 insertions, 5 deletions
diff --git a/include/asm-i386/ioctl.h b/include/asm-i386/ioctl.h
index c75f20ade6b9..2e98645a3788 100644
--- a/include/asm-i386/ioctl.h
+++ b/include/asm-i386/ioctl.h
@@ -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)
+
/* 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)
diff --git a/include/sound/hdsp.h b/include/sound/hdsp.h
index 5f64cc2cf4e4..84d73d20cc83 100644
--- a/include/sound/hdsp.h
+++ b/include/sound/hdsp.h
@@ -71,7 +71,8 @@ struct _snd_hdsp_firmware {
unsigned long firmware_data[24413];
};
-#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW('H', 0x42, hdsp_firmware_t)
+/* This ioctl is marked bad because the type is bigger than the IOCTL description */
+#define SNDRV_HDSP_IOCTL_UPLOAD_FIRMWARE _IOW_BAD('H', 0x42, hdsp_firmware_t)
typedef struct _snd_hdsp_version hdsp_version_t;
diff --git a/include/sound/sscape_ioctl.h b/include/sound/sscape_ioctl.h
index baaa75e258f9..aadc930a6ba4 100644
--- a/include/sound/sscape_ioctl.h
+++ b/include/sound/sscape_ioctl.h
@@ -14,6 +14,8 @@ struct sscape_microcode
};
#define SND_SSCAPE_LOAD_BOOTB _IOWR('P', 100, struct sscape_bootblock)
-#define SND_SSCAPE_LOAD_MCODE _IOW('P', 101, struct sscape_microcode)
+
+/* This ioctl is marked bad because the type is bigger than the IOCTL description */
+#define SND_SSCAPE_LOAD_MCODE _IOW_BAD('P', 101, struct sscape_microcode)
#endif