Linux-HyperV List
 help / color / mirror / Atom feed
* [PATCH] drivers: hv: use kmalloc_array in mshv_root_scheduler_init
@ 2026-05-20  7:16 Can Peng
  2026-05-20  7:55 ` sashiko-bot
  2026-05-27 22:27 ` Wei Liu
  0 siblings, 2 replies; 3+ messages in thread
From: Can Peng @ 2026-05-20  7:16 UTC (permalink / raw)
  To: kys, haiyangz, wei.liu, longli, decui
  Cc: linux-kernel, linux-hyperv, Can Peng

Replace kmalloc() with kmalloc_array() to prevent potential
overflow, as recommended in Documentation/process/deprecated.rst.

Signed-off-by: Can Peng <pengcan@kylinos.cn>
---
 drivers/hv/mshv_root_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hv/mshv_root_main.c b/drivers/hv/mshv_root_main.c
index bd1359eb58dd..146726cc4e9b 100644
--- a/drivers/hv/mshv_root_main.c
+++ b/drivers/hv/mshv_root_main.c
@@ -2241,7 +2241,7 @@ static int mshv_root_scheduler_init(unsigned int cpu)
 	outputarg = (void **)this_cpu_ptr(root_scheduler_output);
 
 	/* Allocate two consecutive pages. One for input, one for output. */
-	p = kmalloc(2 * HV_HYP_PAGE_SIZE, GFP_KERNEL);
+	p = kmalloc_array(2, HV_HYP_PAGE_SIZE, GFP_KERNEL);
 	if (!p)
 		return -ENOMEM;
 
-- 
2.53.0


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

end of thread, other threads:[~2026-05-27 22:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-20  7:16 [PATCH] drivers: hv: use kmalloc_array in mshv_root_scheduler_init Can Peng
2026-05-20  7:55 ` sashiko-bot
2026-05-27 22:27 ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox