Re: [PATCH 1/6] Werror: Fix casting wrong size integer to pointer

From: Andrew Morton
Date: Thu May 29 2008 - 15:20:54 EST


On Thu, 29 May 2008 19:17:26 +0100 David Howells <dhowells@xxxxxxxxxx> wrote:

> --- a/drivers/message/i2o/i2o_config.c
> +++ b/drivers/message/i2o/i2o_config.c
> @@ -886,7 +886,7 @@ static int i2o_cfg_passthru(unsigned long arg)
> flag_count & 0x04000000 /*I2O_SGL_FLAGS_DIR */ ) {
> // TODO 64bit fix
> if (copy_from_user
> - (p, (void __user *)sg[i].addr_bus,
> + (p, (void __user *)(unsigned long)sg[i].addr_bus,
> sg_size)) {
> printk(KERN_DEBUG
> "%s: Could not copy SG buf %d FROM user\n",
> @@ -942,7 +942,7 @@ static int i2o_cfg_passthru(unsigned long arg)
> sg_size = sg[j].flag_count & 0xffffff;
> // TODO 64bit fix
> if (copy_to_user
> - ((void __user *)sg[j].addr_bus, sg_list[j],
> + ((void __user *)(unsigned long)sg[j].addr_bus, sg_list[j],
> sg_size)) {
> printk(KERN_WARNING
> "%s: Could not copy %p TO user %x\n",

yup, what Linus said. This one's been irritating me for years, and I
got close to tempting Markus into fixing it before he departed the
scene. But it remains, as a little "might be busted on 64 bit" reminder.
--
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/