All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Michael Guralnik <michaelgur@nvidia.com>
Cc: linux-rdma@vger.kernel.org
Subject: [bug report] RDMA/mlx5: Switch from MR cache to FRMR pools
Date: Fri, 10 Apr 2026 13:12:19 +0300	[thread overview]
Message-ID: <adjNA5vyWip-LtRM@stanley.mountain> (raw)

Hello Michael Guralnik,

Commit 36680ef7bceb ("RDMA/mlx5: Switch from MR cache to FRMR pools")
from Feb 26, 2026 (linux-next), leads to the following Smatch static
checker warning:

	drivers/infiniband/hw/mlx5/mr.c:299 mlx5r_create_mkeys()
	warn: why is zero skipped 'i'

drivers/infiniband/hw/mlx5/mr.c
    289         for (i = 0; i < count; i++) {
    290                 assign_mkey_variant(dev, handles + i, in);
    291                 err = mlx5_core_create_mkey(dev->mdev, handles + i, in, inlen);
    292                 if (err)
    293                         goto free_in;
    294         }
    295 free_in:
    296         kfree(in);
    297         if (err)
    298                 for (; i > 0; i--)
                               ^^^^^
This should be >= 0 or we leak the first array element.

--> 299                         mlx5_core_destroy_mkey(dev->mdev, handles[i]);
    300         return err;
    301 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

                 reply	other threads:[~2026-04-10 10:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=adjNA5vyWip-LtRM@stanley.mountain \
    --to=error27@gmail.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.