diff options
author | Szabolcs Nagy <nsz@port70.net> | 2013-05-26 15:49:08 +0000 |
---|---|---|
committer | Szabolcs Nagy <nsz@port70.net> | 2013-05-26 15:49:08 +0000 |
commit | 41c34d188a598b016d62e152735f8466fe9910a4 (patch) | |
tree | 90efa948a7901fbfb9450a33373c17efec3f666c /arch | |
parent | a6367a17d5f77848e8313b1e5e42698aec92908d (diff) | |
download | musl-41c34d188a598b016d62e152735f8466fe9910a4.zip musl-41c34d188a598b016d62e152735f8466fe9910a4.tar.gz musl-41c34d188a598b016d62e152735f8466fe9910a4.tar.bz2 |
fix ioctl _IOR, _IOW, etc macros to avoid signed overflow (2<<30)
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/bits/ioctl.h | 6 | ||||
-rw-r--r-- | arch/i386/bits/ioctl.h | 6 | ||||
-rw-r--r-- | arch/microblaze/bits/ioctl.h | 6 | ||||
-rw-r--r-- | arch/mips/bits/ioctl.h | 8 | ||||
-rw-r--r-- | arch/powerpc/bits/ioctl.h | 25 | ||||
-rw-r--r-- | arch/x86_64/bits/ioctl.h | 6 |
6 files changed, 19 insertions, 38 deletions
diff --git a/arch/arm/bits/ioctl.h b/arch/arm/bits/ioctl.h index 336c71c..9d75118 100644 --- a/arch/arm/bits/ioctl.h +++ b/arch/arm/bits/ioctl.h @@ -4,9 +4,9 @@ #define _IOC_READ 2U #define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0) -#define _IOW(a,b,c) _IOC(1,(a),(b),sizeof(c)) -#define _IOR(a,b,c) _IOC(2,(a),(b),sizeof(c)) -#define _IOWR(a,b,c) _IOC(3,(a),(b),sizeof(c)) +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c)) #define TCGETS 0x5401 #define TCSETS 0x5402 diff --git a/arch/i386/bits/ioctl.h b/arch/i386/bits/ioctl.h index 336c71c..9d75118 100644 --- a/arch/i386/bits/ioctl.h +++ b/arch/i386/bits/ioctl.h @@ -4,9 +4,9 @@ #define _IOC_READ 2U #define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0) -#define _IOW(a,b,c) _IOC(1,(a),(b),sizeof(c)) -#define _IOR(a,b,c) _IOC(2,(a),(b),sizeof(c)) -#define _IOWR(a,b,c) _IOC(3,(a),(b),sizeof(c)) +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c)) #define TCGETS 0x5401 #define TCSETS 0x5402 diff --git a/arch/microblaze/bits/ioctl.h b/arch/microblaze/bits/ioctl.h index 336c71c..9d75118 100644 --- a/arch/microblaze/bits/ioctl.h +++ b/arch/microblaze/bits/ioctl.h @@ -4,9 +4,9 @@ #define _IOC_READ 2U #define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0) -#define _IOW(a,b,c) _IOC(1,(a),(b),sizeof(c)) -#define _IOR(a,b,c) _IOC(2,(a),(b),sizeof(c)) -#define _IOWR(a,b,c) _IOC(3,(a),(b),sizeof(c)) +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c)) #define TCGETS 0x5401 #define TCSETS 0x5402 diff --git a/arch/mips/bits/ioctl.h b/arch/mips/bits/ioctl.h index 5040226..83fb167 100644 --- a/arch/mips/bits/ioctl.h +++ b/arch/mips/bits/ioctl.h @@ -3,10 +3,10 @@ #define _IOC_READ 2U #define _IOC_WRITE 4U -#define _IO(a,b) _IOC(1U,(a),(b),0) -#define _IOW(a,b,c) _IOC(4U,(a),(b),sizeof(c)) -#define _IOR(a,b,c) _IOC(2U,(a),(b),sizeof(c)) -#define _IOWR(a,b,c) _IOC(6U,(a),(b),sizeof(c)) +#define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0) +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c)) #define TCGETA 0x5401 #define TCSETA 0x5402 diff --git a/arch/powerpc/bits/ioctl.h b/arch/powerpc/bits/ioctl.h index 15cd6c7..0c903dc 100644 --- a/arch/powerpc/bits/ioctl.h +++ b/arch/powerpc/bits/ioctl.h @@ -1,31 +1,12 @@ -//#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) ) -// -#define _IOC_SIZEBITS 13 -#define _IOC_DIRBITS 3 - -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 - -#define _IOC_NRSHIFT 0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) - -#define _IOC(dir,type,nr,size) \ - (((dir) << _IOC_DIRSHIFT) | \ - ((type) << _IOC_TYPESHIFT) | \ - ((nr) << _IOC_NRSHIFT) | \ - ((size) << _IOC_SIZESHIFT)) - - +#define _IOC(a,b,c,d) ( ((a)<<29) | ((b)<<8) | (c) | ((d)<<16) ) #define _IOC_NONE 1U #define _IOC_WRITE 4U #define _IOC_READ 2U #define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0) #define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c)) -#define _IOR(a,b,c) _IOC(_IOC_READ ,(a),(b),sizeof(c)) -#define _IOWR(a,b,c) _IOC(_IOC_READ | _IOC_WRITE,(a),(b),sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c)) #define FIONCLEX _IO('f', 2) #define FIOCLEX _IO('f', 1) diff --git a/arch/x86_64/bits/ioctl.h b/arch/x86_64/bits/ioctl.h index 7f3c038..77a9455 100644 --- a/arch/x86_64/bits/ioctl.h +++ b/arch/x86_64/bits/ioctl.h @@ -4,9 +4,9 @@ #define _IOC_READ 2U #define _IO(a,b) _IOC(_IOC_NONE,(a),(b),0) -#define _IOW(a,b,c) _IOC(1,(a),(b),sizeof(c)) -#define _IOR(a,b,c) _IOC(2,(a),(b),sizeof(c)) -#define _IOWR(a,b,c) _IOC(3,(a),(b),sizeof(c)) +#define _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),sizeof(c)) #define TCGETS 0x5401 #define TCSETS 0x5402 |