From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Edward Srouji <edwards@nvidia.com>,
Michael Guralnik <michaelgur@nvidia.com>
Cc: Leon Romanovsky <leon@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>,
linux-rdma@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RDMA/mlx5: issue with error checking
Date: Thu, 17 Jul 2025 12:36:06 +0100 [thread overview]
Message-ID: <79166fb1-3b73-4d37-af02-a17b22eb8e64@gmail.com> (raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 1266 bytes --]
Hi
Static analysis detected an issue with the following commit:
commit e73242aa14d2ec7f4a1a13688366bb36dc0fe5b7
Author: Edward Srouji <edwards@nvidia.com>
Date: Wed Jul 9 09:42:11 2025 +0300
RDMA/mlx5: Optimize DMABUF mkey page size
The issue is as follows:
int mlx5r_umr_dmabuf_update_pgsz(struct mlx5_ib_mr *mr, u32 xlt_flags,
unsigned int page_shift)
{
unsigned int old_page_shift = mr->page_shift;
size_t zapped_blocks;
size_t total_blocks;
int err;
zapped_blocks = _mlx5r_umr_zap_mkey(mr, xlt_flags, page_shift,
mr->data_direct);
if (zapped_blocks < 0)
return zapped_blocks;
The variable zapped_blocks is a size_t type and is being assigned a int
return value from the call to _mlx5r_umr_zap_mkey. Since zapped_blocks
is an unsigned type, the error check for zapped_blocks < 0 will never be
true. I suspect total_blocks should be a ssize_t type, but that
probably also means total_blocks should be ssize_t too, but don't have
the hardware to test this fix and I'm concerned that this change may
break the code. Hence I'm reporting this issue.
Colin
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 4901 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next reply other threads:[~2025-07-17 11:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-17 11:36 Colin King (gmail) [this message]
2025-07-20 7:18 ` 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=79166fb1-3b73-4d37-af02-a17b22eb8e64@gmail.com \
--to=colin.i.king@gmail.com \
--cc=edwards@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=michaelgur@nvidia.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
all inboxes | Powered by JetHome®