Re: [PATCH 7/9] [3.18-stable] i2o: hide unsafe ioctl on 64-bit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 05, 2017 at 08:36:55PM +0200, Arnd Bergmann wrote:
> On Fri, May 5, 2017 at 7:13 PM, Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> > On Fri, May 05, 2017 at 01:57:23PM +0200, Arnd Bergmann wrote:
> >> We get a warning about a broken pointer conversion on 64-bit architectures:
> >>
> >> drivers/message/i2o/i2o_config.c: In function 'i2o_cfg_passthru':
> >> drivers/message/i2o/i2o_config.c:893:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> >>          (p->virt, (void __user *)sg[i].addr_bus,
> >>                    ^
> >> drivers/message/i2o/i2o_config.c:953:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
> >>          ((void __user *)sg[j].addr_bus, sg_list[j].virt,
> >>           ^
> >>
> >> This has clearly never worked right, so we can add an #ifdef around the code.
> >> The driver was moved to staging in linux-4.0 and finally removed in 4.2,
> >> so upstream does not have a fix for it.
> >>
> >> The driver originally got this mostly right, though probably by accident.
> >
> > I fixed this in a different way, doing the cast to make things be quiet,
> > as was done in other places in the driver.  You were copied on that
> > patch when it was added to my tree, right?
> 
> I missed it when you sent it, but looking at it now, I think it introduces
> another warning, on 32-bit architectures:
> 
> -                                   (p->virt, (void __user *)sg[i].addr_bus,
> +                                   (p->virt, (void __user
> *)(u64)sg[i].addr_bus,
> 
> I think you need '(void __user *)(uintptr_t)sg[i].addr_bus' to
> shut up the warning for all builds.

Ah good point.  I've now dropped my version and taken yours instead :)

thanks,

greg k-h



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]