linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dma-mapping: Fix sizeof() mismatch on tsk allocation
@ 2020-11-25 14:05 Colin King
  2020-11-25 18:26 ` Song Bao Hua (Barry Song)
  0 siblings, 1 reply; 5+ messages in thread
From: Colin King @ 2020-11-25 14:05 UTC (permalink / raw)
  To: Barry Song, Christoph Hellwig, Marek Szyprowski, Robin Murphy, iommu
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

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@canonical.com>
---
 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);
 	if (!tsk)
 		return -ENOMEM;
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-26 17:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 14:05 [PATCH] dma-mapping: Fix sizeof() mismatch on tsk allocation Colin King
2020-11-25 18:26 ` Song Bao Hua (Barry Song)
2020-11-25 18:29   ` Christoph Hellwig
2020-11-25 18:49     ` Colin Ian King
2020-11-26 17:06       ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).