mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anton Ivanov <anton.ivanov@cambridgegreys.com>
To: Hungyu Lin <dennylin0707@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	Johannes Berg <johannes@sipsolutions.net>
Cc: linux-um@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] um: vector: use kmalloc_objs() for the message vector
Date: Tue, 20 Oct 2026 08:37:17 +0100	[thread overview]
Message-ID: <e1418f63-6815-4732-b07f-934414ebd124@cambridgegreys.com> (raw)
In-Reply-To: <20261020072035.8980-1-dennylin0707@gmail.com>

On 20/10/2026 08:20, Hungyu Lin wrote:
> 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
> 
> 
Acked-By: Anton Ivanov <anton.ivanov@cambridgegreys.com>

-- 
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661

      reply	other threads:[~2026-10-20  7:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  7:20 Hungyu Lin
2026-10-20  7:37 ` Anton Ivanov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e1418f63-6815-4732-b07f-934414ebd124@cambridgegreys.com \
    --to=anton.ivanov@cambridgegreys.com \
    --cc=dennylin0707@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-um@lists.infradead.org \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®