Re: [PATCH] incorrect use of sizeof() in ioctl definitions

From: Russell King
Date: Tue Sep 30 2003 - 16:38:00 EST


On Tue, Sep 30, 2003 at 02:08:05PM -0700, Andrew Morton wrote:
> diff -puN drivers/video/aty/aty128fb.c~sizeof-in-ioctl-fix drivers/video/aty/aty128fb.c
> --- 25/drivers/video/aty/aty128fb.c~sizeof-in-ioctl-fix Tue Sep 30 14:04:12 2003
> +++ 25-akpm/drivers/video/aty/aty128fb.c Tue Sep 30 14:04:12 2003
> @@ -2041,9 +2041,9 @@ aty128fb_setcolreg(u_int regno, u_int re
> #define ATY_MIRROR_CRT_ON 0x00000002
>
> /* out param: u32* backlight value: 0 to 15 */
> -#define FBIO_ATY128_GET_MIRROR _IOR('@', 1, sizeof(__u32*))
> +#define FBIO_ATY128_GET_MIRROR _IOR('@', 1, __u32*)
> /* in param: u32* backlight value: 0 to 15 */
> -#define FBIO_ATY128_SET_MIRROR _IOW('@', 2, sizeof(__u32*))
> +#define FBIO_ATY128_SET_MIRROR _IOW('@', 2, __u32*)
>
> static int aty128fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
> u_long arg, struct fb_info *info)
>
>
> Matthew's conversion mainly converted things to size_t, but from the looks
> of it, __u32* is the right thing to use in this case, I think?

sizeof(__u32*) may not be sizeof(sizeof(__u32*)), so this would be an API
change... Therefore, all these wrong entries need to change to size_t
(preferably with the real type following inside a comment so we don't
loose useful information.)

--
Russell King (rmk@xxxxxxxxxxxxxxxx) http://www.arm.linux.org.uk/personal/
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/