public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] RDMA/mlx5: Switch from MR cache to FRMR pools
@ 2026-04-10 10:12 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2026-04-10 10:12 UTC (permalink / raw)
  To: Michael Guralnik; +Cc: linux-rdma

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-10 10:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 10:12 [bug report] RDMA/mlx5: Switch from MR cache to FRMR pools Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox