Re: [PATCH 2/2] staging/lustre/libcfs: cleanup libcfs_kkuc_msg_put a bit

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

 



On Thu, Jun 06, 2013 at 11:04:07PM +0800, Peng Tao wrote:
> No need to cast count since it is already ssize_t. No need
> to cast payload to const, but need __force instead to avoid
> Sparse complaining.

That usually means something is really wrong here.

> Reported-and-Suggested-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Signed-off-by: Peng Tao <tao.peng@xxxxxxx>
> Signed-off-by: Andreas Dilger <andreas.dilger@xxxxxxxxx>
> ---
>  .../lustre/lustre/libcfs/kernel_user_comm.c        |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
> index 8084ada..d6d3b2e 100644
> --- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
> +++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
> @@ -170,8 +170,8 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload)

payload should be __user, right?  That should solve this problem
instead.  Ah, but you need to unwind some other functions to get this to
work properly, but that looks like the correct thing to do, instead of
this:

>  
>  	fs = get_fs();
>  	set_fs(KERNEL_DS);
> -	while ((ssize_t)count > 0) {
> -		rc = vfs_write(filp, (const void __user *)payload,
> +	while (count > 0) {
> +		rc = vfs_write(filp, (void __force __user *)payload,
>  			       count, &offset);

I don't want to take this, sorry.

greg k-h
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux