From 003e16bb4394886d1adcf01b4a23a6ad8240c2b9 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 7 Sep 2003 08:12:49 -0700 Subject: [PATCH] Fix more ioctl _IOR/_IOW misusage. --- drivers/ieee1394/ieee1394-ioctl.h | 8 ++++++-- include/linux/capi.h | 4 ++-- include/linux/i8k.h | 4 ++-- include/linux/toshiba.h | 2 +- include/video/sisfb.h | 11 +++++++++-- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/drivers/ieee1394/ieee1394-ioctl.h b/drivers/ieee1394/ieee1394-ioctl.h index 24ef3b38af925..f92b566363d5e 100644 --- a/drivers/ieee1394/ieee1394-ioctl.h +++ b/drivers/ieee1394/ieee1394-ioctl.h @@ -60,9 +60,13 @@ _IOWR('#', 0x14, struct video1394_mmap) #define VIDEO1394_IOC_UNTALK_CHANNEL \ _IOW ('#', 0x15, int) +/* + * This one is broken: it really wanted + * "sizeof (struct video1394_wait) + sizeof (struct video1394_queue_variable)" + * but got just a "size_t" + */ #define VIDEO1394_IOC_TALK_QUEUE_BUFFER \ - _IOW ('#', 0x16, sizeof (struct video1394_wait) + \ - sizeof (struct video1394_queue_variable)) + _IOW ('#', 0x16, size_t) #define VIDEO1394_IOC_TALK_WAIT_BUFFER \ _IOW ('#', 0x17, struct video1394_wait) #define VIDEO1394_IOC_LISTEN_POLL_BUFFER \ diff --git a/include/linux/capi.h b/include/linux/capi.h index f474920a75418..501ea6d59ae66 100644 --- a/include/linux/capi.h +++ b/include/linux/capi.h @@ -36,7 +36,7 @@ typedef struct capi_register_params { /* CAPI_REGISTER */ #define CAPI_MANUFACTURER_LEN 64 -#define CAPI_GET_MANUFACTURER _IOWR('C',0x06,CAPI_MANUFACTURER_LEN) +#define CAPI_GET_MANUFACTURER _IOWR('C',0x06,int) /* broken: wanted size 64 (CAPI_MANUFACTURER_LEN) */ /* * CAPI_GET_VERSION @@ -56,7 +56,7 @@ typedef struct capi_version { */ #define CAPI_SERIAL_LEN 8 -#define CAPI_GET_SERIAL _IOWR('C',0x08, CAPI_SERIAL_LEN) +#define CAPI_GET_SERIAL _IOWR('C',0x08,int) /* broken: wanted size 8 (CAPI_SERIAL_LEN) */ /* * CAPI_GET_PROFILE diff --git a/include/linux/i8k.h b/include/linux/i8k.h index 8ae0873f6eaa1..1c45ba505115b 100644 --- a/include/linux/i8k.h +++ b/include/linux/i8k.h @@ -20,8 +20,8 @@ #define I8K_PROC "/proc/i8k" #define I8K_PROC_FMT "1.0" -#define I8K_BIOS_VERSION _IOR ('i', 0x80, 4) -#define I8K_MACHINE_ID _IOR ('i', 0x81, 16) +#define I8K_BIOS_VERSION _IOR ('i', 0x80, int) /* broken: meant 4 bytes */ +#define I8K_MACHINE_ID _IOR ('i', 0x81, int) /* broken: meant 16 bytes */ #define I8K_POWER_STATUS _IOR ('i', 0x82, size_t) #define I8K_FN_STATUS _IOR ('i', 0x83, size_t) #define I8K_GET_TEMP _IOR ('i', 0x84, size_t) diff --git a/include/linux/toshiba.h b/include/linux/toshiba.h index 8865b6bb152da..916e5e3a699b6 100644 --- a/include/linux/toshiba.h +++ b/include/linux/toshiba.h @@ -22,7 +22,7 @@ #define TOSH_PROC "/proc/toshiba" #define TOSH_DEVICE "/dev/toshiba" -#define TOSH_SMM _IOWR('t', 0x90, 24) +#define TOSH_SMM _IOWR('t', 0x90, int) /* broken: meant 24 bytes */ typedef struct { unsigned int eax; diff --git a/include/video/sisfb.h b/include/video/sisfb.h index 438746dc51fae..11ebb1e816836 100644 --- a/include/video/sisfb.h +++ b/include/video/sisfb.h @@ -145,9 +145,16 @@ struct video_info { /* If changing this, vgatypes.h must also be changed (for X driver) */ /* TW: ioctl for identifying and giving some info (esp. memory heap start) */ -#define SISFB_GET_INFO _IOR('n',0xF8,sizeof(__u32)) -#define SISFB_GET_VBRSTATUS _IOR('n',0xF9,sizeof(__u32)) +/* + * NOTE! The ioctl types used to be "size_t" by mistake, but were + * really meant to be __u32. Changed to "__u32" even though that + * changes the value on 64-bit architectures, because the value + * (with a 4-byte size) is also hardwired in vgatypes.h for user + * space exports. So "__u32" is actually more compatible, duh! + */ +#define SISFB_GET_INFO _IOR('n',0xF8,__u32) +#define SISFB_GET_VBRSTATUS _IOR('n',0xF9,__u32) /* TW: Structure argument for SISFB_GET_INFO ioctl */ typedef struct _SISFB_INFO sisfb_info, *psisfb_info; -- 2.53.0