mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] um: vector: use kmalloc_objs() for the message vector
@ 2026-10-20  7:20 Hungyu Lin
  2026-10-20  7:37 ` Anton Ivanov
  0 siblings, 1 reply; 2+ messages in thread
From: Hungyu Lin @ 2026-10-20  7:20 UTC (permalink / raw)
  To: Richard Weinberger, Anton Ivanov, Johannes Berg
  Cc: linux-um, linux-kernel, Hungyu Lin

Allocate mmsg_vector with kmalloc_objs() so the element size is derived
from the destination type and the allocation helper handles multiplication
overflow. The default allocation flags remain GFP_KERNEL.

Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
 arch/um/drivers/vector_kern.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
index e902e78c5ff6..d6127944b202 100644
--- a/arch/um/drivers/vector_kern.c
+++ b/arch/um/drivers/vector_kern.c
@@ -528,8 +528,7 @@ static struct vector_queue *create_queue(
 		return NULL;
 	result->max_depth = max_size;
 	result->dev = vp->dev;
-	result->mmsg_vector = kmalloc(
-		(sizeof(struct mmsghdr) * max_size), GFP_KERNEL);
+	result->mmsg_vector = kmalloc_objs(*result->mmsg_vector, max_size);
 	if (result->mmsg_vector == NULL)
 		goto out_mmsg_fail;
 	result->skbuff_vector = kmalloc(

base-commit: 4ad423aa2108485f8bc5dde51fdf9c1ed979ee4b

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

end of thread, other threads:[~2026-10-20  7:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-20  7:20 [PATCH] um: vector: use kmalloc_objs() for the message vector Hungyu Lin
2026-10-20  7:37 ` Anton Ivanov

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

all inboxes | Powered by JetHome®