RE: [PATCH] dma-mapping: Fix sizeof() mismatch on tsk allocation

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

 




> -----Original Message-----
> From: Colin King [mailto:colin.king@xxxxxxxxxxxxx]
> Sent: Thursday, November 26, 2020 3:05 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 sizeof() mismatch on tsk allocation
> 
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> 
> An incorrect sizeof() is being used, sizeof(tsk) is not correct, it should
> be sizeof(*tsk). Fix it.
> 
> Addresses-Coverity: ("Sizeof not portable (SIZEOF_MISMATCH)")
> Fixes: bfd2defed94d ("dma-mapping: add benchmark support for streaming
> DMA APIs")
> Signed-off-by: Colin Ian King <colin.king@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 e1e37603d01b..b1496e744c68 100644
> --- a/kernel/dma/map_benchmark.c
> +++ b/kernel/dma/map_benchmark.c
> @@ -121,7 +121,7 @@ static int do_map_benchmark(struct
> map_benchmark_data *map)
>  	int ret = 0;
>  	int i;
> 
> -	tsk = kmalloc_array(threads, sizeof(tsk), GFP_KERNEL);
> +	tsk = kmalloc_array(threads, sizeof(*tsk), GFP_KERNEL);

The size is same. But the change is correct.
Acked-by: Barry Song <song.bao.hua@xxxxxxxxxxxxx>

>  	if (!tsk)
>  		return -ENOMEM;
> 
Thanks
Barry






[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux