Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Allison Henderson <achender@kernel.org>
To: Weimin Xiong <xiongwm2026@163.com>
Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	 rds-devel@oss.oracle.com, linux-kernel@vger.kernel.org,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>
Subject: Re: [PATCH] rds: use krealloc_array() for iovector growth
Date: Thu, 16 Jul 2026 18:00:06 -0700	[thread overview]
Message-ID: <428d61ca599cdcb5f42818af5a9c7e80d4eef5dc.camel@kernel.org> (raw)
In-Reply-To: <20260716025101.118159-1-xiongwm2026@163.com>

On Thu, 2026-07-16 at 10:51 +0800, Weimin Xiong wrote:
> Use krealloc_array() for growing the RDS iovector array. This makes the
> array allocation overflow-safe and derives the element size from the
> array pointer.
> 
> Signed-off-by: Weimin Xiong <xiongwm2026@163.com>

Hi Weinmin,

Thanks for working on this.  This looks mostly good to me, the conversion
looks correct.  Just one nit, since this is a hardening fix
and not a bug fix, it should target the net-next branch in the subject
line like this:

[PATCH net-next v2] net/rds: use krealloc_array() for iovector growth

With that fixed, you can add my rvb:
Reviewed-by: Allison Henderson <achender@kernel.org>

Thanks!
Allison

> ---
> diff --git a/net/rds/send.c b/net/rds/send.c
> index 68be1bf0e..6a567c97a 100644
> --- a/net/rds/send.c
> +++ b/net/rds/send.c
> @@ -971,11 +971,8 @@ static int rds_rm_size(struct msghdr *msg, int num_sgs,
>  				return -EINVAL;
>  			if (vct->indx >= vct->len) {
>  				vct->len += vct->incr;
> -				tmp_iov =
> -					krealloc(vct->vec,
> -						 vct->len *
> -						 sizeof(struct rds_iov_vector),
> -						 GFP_KERNEL);
> +				tmp_iov = krealloc_array(vct->vec, vct->len,
> +							 sizeof(*vct->vec), GFP_KERNEL);
>  				if (!tmp_iov) {
>  					vct->len -= vct->incr;
>  					return -ENOMEM;
> 


      reply	other threads:[~2026-07-17  1:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  2:51 [PATCH] rds: use krealloc_array() for iovector growth Weimin Xiong
2026-07-17  1:00 ` Allison Henderson [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=428d61ca599cdcb5f42818af5a9c7e80d4eef5dc.camel@kernel.org \
    --to=achender@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rds-devel@oss.oracle.com \
    --cc=xiongwm2026@163.com \
    /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