RE: [PATCH] dma-mapping: fix an uninitialized pointer read due to typo in argp assignment

From: Song Bao Hua (Barry Song)
Date: Wed Nov 25 2020 - 13:22:33 EST




> -----Original Message-----
> From: Colin King [mailto:colin.king@xxxxxxxxxxxxx]
> Sent: Thursday, November 26, 2020 2:56 AM
> To: Song Bao Hua (Barry Song) <song.bao.hua@xxxxxxxxxxxxx>; Christoph
> Hellwig <hch@xxxxxx>; Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>;
> Robin Murphy <robin.murphy@xxxxxxx>; iommu@xxxxxxxxxxxxxxxxxxxxxxxxxx
> Cc: kernel-janitors@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: [PATCH] dma-mapping: fix an uninitialized pointer read due to typo in
> argp assignment
>
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> The assignment of argp is currently using argp as the source because of
> a typo. Fix this by assigning it the value passed in arg instead.
>
> Addresses-Coverity: ("Uninitialized pointer read")
> Fixes: bfd2defed94d ("dma-mapping: add benchmark support for streaming
> DMA APIs")
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>

Acked-by: Barry Song <song.bao.hua@xxxxxxxxxxxxx>

> ---
> kernel/dma/map_benchmark.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/dma/map_benchmark.c b/kernel/dma/map_benchmark.c
> index ca616b664f72..e1e37603d01b 100644
> --- a/kernel/dma/map_benchmark.c
> +++ b/kernel/dma/map_benchmark.c
> @@ -192,7 +192,7 @@ static long map_benchmark_ioctl(struct file *file,
> unsigned int cmd,
> unsigned long arg)
> {
> struct map_benchmark_data *map = file->private_data;
> - void __user *argp = (void __user *)argp;
> + void __user *argp = (void __user *)arg;
> u64 old_dma_mask;
>
> int ret;
> --
> 2.29.2

Thanks
Barry