public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>, Parav Pandit <parav@mellanox.com>,
	Jack Morgenstein <jackm@mellanox.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH v3][next] RDMA/core: Use size_{add,sub,mul}() in calls to struct_size()
Date: Tue, 19 Sep 2023 10:37:15 +0300	[thread overview]
Message-ID: <20230919073715.GC4494@unreal> (raw)
In-Reply-To: <ZQdt4NsJFwwOYxUR@work>

On Sun, Sep 17, 2023 at 03:21:36PM -0600, Gustavo A. R. Silva wrote:
> If, for any reason, the open-coded arithmetic causes a wraparound,

The thing is that it doesn't.

> the protection that `struct_size()` provides against potential integer
> overflows is defeated. Fix this by hardening calls to `struct_size()`
> with `size_add()`, `size_sub()` and `size_mul()`.
> 
> Fixes: 467f432a521a ("RDMA/core: Split port and device counter sysfs attributes")
> Fixes: a4676388e2e2 ("RDMA/core: Simplify how the gid_attrs sysfs is created")
> Fixes: e9dd5daf884c ("IB/umad: Refactor code to use cdev_device_add()")
> Fixes: 324e227ea7c9 ("RDMA/device: Add ib_device_get_by_netdev()")
> Fixes: 5aad26a7eac5 ("IB/core: Use struct_size() in kzalloc()")
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> ---
> Changes in v3:
>  - Include changes to other files in drivers/infiniband/core/
>  - Update changelog text with a more descriptive argument for the
>    changes.
>  - Add more `Fixes:` tags.

I don't think that any of these Fixes are necessary, as nothing wrong
in the code you changed.

Thanks

  reply	other threads:[~2023-09-19  7:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-17 21:21 [PATCH v3][next] RDMA/core: Use size_{add,sub,mul}() in calls to struct_size() Gustavo A. R. Silva
2023-09-19  7:37 ` Leon Romanovsky [this message]
2023-09-19  7:37 ` Leon Romanovsky

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=20230919073715.GC4494@unreal \
    --to=leon@kernel.org \
    --cc=gustavo@embeddedor.com \
    --cc=gustavoars@kernel.org \
    --cc=jackm@mellanox.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=parav@mellanox.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