Re: [PATCH v3] mmc: Add ioctl to let userspace apps send ACMDs

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

 



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

[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux