|
Message-ID: <20240601010328.27409-1-ismael@iodev.co.uk> Date: Sat, 1 Jun 2024 03:03:25 +0200 From: Ismael Luceno <ismael@...ev.co.uk> To: musl@...ts.openwall.com Cc: Rich Felker <dalias@...c.org>, Ismael Luceno <ismael@...ev.co.uk> Subject: [PATCH] ioctl: Fix implicit constant conversion overflow The last parameter (result of sizeof) to _IOC in _IOR/_IOW/_IOWR causes the underlying expression's value to be promoted to size_t. Casting it to int resolves the issue. Signed-off-by: Ismael Luceno <ismael@...ev.co.uk> --- arch/generic/bits/ioctl.h | 6 +++--- arch/mips/bits/ioctl.h | 6 +++--- arch/mipsn32/bits/ioctl.h | 6 +++--- arch/powerpc/bits/ioctl.h | 6 +++--- arch/powerpc64/bits/ioctl.h | 6 +++--- arch/sh/bits/ioctl.h | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/arch/generic/bits/ioctl.h b/arch/generic/bits/ioctl.h index 60ae8b850b17..16541d547f68 100644 --- a/arch/generic/bits/ioctl.h +++ b/arch/generic/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(_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 _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),(int)sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),(int)sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),(int)sizeof(c)) #define TCGETS 0x5401 #define TCSETS 0x5402 diff --git a/arch/mips/bits/ioctl.h b/arch/mips/bits/ioctl.h index e20bf19eaa77..e165bb8588a2 100644 --- a/arch/mips/bits/ioctl.h +++ b/arch/mips/bits/ioctl.h @@ -4,9 +4,9 @@ #define _IOC_WRITE 4U #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 _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),(int)sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),(int)sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),(int)sizeof(c)) #define TCGETA 0x5401 #define TCSETA 0x5402 diff --git a/arch/mipsn32/bits/ioctl.h b/arch/mipsn32/bits/ioctl.h index e20bf19eaa77..e165bb8588a2 100644 --- a/arch/mipsn32/bits/ioctl.h +++ b/arch/mipsn32/bits/ioctl.h @@ -4,9 +4,9 @@ #define _IOC_WRITE 4U #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 _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),(int)sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),(int)sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),(int)sizeof(c)) #define TCGETA 0x5401 #define TCSETA 0x5402 diff --git a/arch/powerpc/bits/ioctl.h b/arch/powerpc/bits/ioctl.h index ac9bfd204a84..a9f45f321abc 100644 --- a/arch/powerpc/bits/ioctl.h +++ b/arch/powerpc/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(_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 _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),(int)sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),(int)sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),(int)sizeof(c)) #define FIONCLEX _IO('f', 2) #define FIOCLEX _IO('f', 1) diff --git a/arch/powerpc64/bits/ioctl.h b/arch/powerpc64/bits/ioctl.h index b6cbb18f4776..425d96a44444 100644 --- a/arch/powerpc64/bits/ioctl.h +++ b/arch/powerpc64/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(_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 _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),(int)sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),(int)sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),(int)sizeof(c)) #define FIONCLEX _IO('f', 2) #define FIOCLEX _IO('f', 1) diff --git a/arch/sh/bits/ioctl.h b/arch/sh/bits/ioctl.h index 370b6901e261..7d423e861c52 100644 --- a/arch/sh/bits/ioctl.h +++ b/arch/sh/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(_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 _IOW(a,b,c) _IOC(_IOC_WRITE,(a),(b),(int)sizeof(c)) +#define _IOR(a,b,c) _IOC(_IOC_READ,(a),(b),(int)sizeof(c)) +#define _IOWR(a,b,c) _IOC(_IOC_READ|_IOC_WRITE,(a),(b),(int)sizeof(c)) #define FIOCLEX _IO('f', 1) #define FIONCLEX _IO('f', 2) -- 2.44.0
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.