Re: [PATCH][next] io_uring: Fix incorrect sizeof operator for copy_from_user call

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

 



On 15/06/2021 11:45, Colin King wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> 
> Static analysis is warning that the sizeof being used is should be
> of *data->tags[i] and not data->tags[i]. Although these are the same
> size on 64 bit systems it is not a portable assumption to assume
> this is true for all cases.
> 
> Addresses-Coverity: ("Sizeof not portable")
> Fixes: d878c81610e1 ("io_uring: hide rsrc tag copy into generic helpers")
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> ---
>  fs/io_uring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index d665c9419ad3..6b1a70449749 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -7231,7 +7231,7 @@ static int io_rsrc_data_alloc(struct io_ring_ctx *ctx, rsrc_put_fn *do_put,
>  		ret = -EFAULT;
>  		for (i = 0; i < nr; i++) {
>  			if (copy_from_user(io_get_tag_slot(data, i), &utags[i],
> -					   sizeof(data->tags[i])))
> +					   sizeof(*data->tags[i])))
>  				goto fail;
>  		}
>  	}
> 

Actually, I think there is also an issue on line 7220 too, I'll fix that
and re-send.



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux