On Mon, 11 Apr 2011, Chris Ball wrote:
> This adds two gcc warnings here (compiling for ARM):
> 
>   CC      drivers/mmc/card/block.o
> drivers/mmc/card/block.c: In function ‘mmc_blk_ioctl_copy_from_user’:
> drivers/mmc/card/block.c:199:33: warning: cast to pointer from integer of 
> different size [-Wint-to-pointer-cast]
> drivers/mmc/card/block.c: In function ‘mmc_blk_ioctl_acmd’:
> drivers/mmc/card/block.c:308:20: warning: cast to pointer from integer of 
> different size [-Wint-to-pointer-cast]
> 
> ...
> > +   if (copy_from_user(idata->buf, (u8 *) user->data_ptr, 
> > idata->buf_bytes)) {
> > +           err = -EFAULT;
> > +           goto copy_err;
> > +   }
> ...
> > +           if (copy_to_user((u8 *) ic_ptr->data_ptr, idata->buf, 
> > idata->buf_bytes)) {
> > +                   err = -EFAULT;
> > +                   goto acmd_rel_host;
> > +           }
> ...
> 

Hrmmm...  So, what's the correct way to do this compat_ioctl() stuff?
My first attempt at a compat_ioctl() implementation in v2 used a 32bit
version of the structure to marshall the data.  That was shot down as
being unnecessarily complicated since the buffer pointer was the only
thing that was not compat friendly.  It was recommended that I could
just make this a 64bit int field and let the callers do the appropriate
casting.  However, this latter solution (implemented in v3) causes the
compiler warning that you describe above.

Should I revert to the v2 implementation?

John

Reply via email to