From: sunliming@linux.dev
To: siva.kallam@broadcom.com, gg@ziepe.ca, leon@kernel.org
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
sunliming <sunliming@kylinos.cn>,
kernel test robot <lkp@intel.com>,
Dan Carpenter <error27@gmail.com>
Subject: [PATCH] RDMA/bng_re: fix variable dereferenced before check in bng_re_net_ring_free()
Date: Tue, 6 Jan 2026 20:03:43 +0800 [thread overview]
Message-ID: <20260106120343.54758-1-sunliming@linux.dev> (raw)
From: sunliming <sunliming@kylinos.cn>
Fix below smatch warnings:
drivers/infiniband/hw/bng_re/bng_dev.c:113 bng_re_net_ring_free() warn:
variable dereferenced before check 'rdev'
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202601010413.sWadrQel-lkp@intel.com/
Signed-off-by: sunliming <sunliming@kylinos.cn>
---
drivers/infiniband/hw/bng_re/bng_dev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/bng_re/bng_dev.c b/drivers/infiniband/hw/bng_re/bng_dev.c
index d8f8d7f7075f..c32395d1593f 100644
--- a/drivers/infiniband/hw/bng_re/bng_dev.c
+++ b/drivers/infiniband/hw/bng_re/bng_dev.c
@@ -118,7 +118,7 @@ static void bng_re_fill_fw_msg(struct bnge_fw_msg *fw_msg, void *msg,
static int bng_re_net_ring_free(struct bng_re_dev *rdev,
u16 fw_ring_id, int type)
{
- struct bnge_auxr_dev *aux_dev = rdev->aux_dev;
+ struct bnge_auxr_dev *aux_dev;
struct hwrm_ring_free_input req = {};
struct hwrm_ring_free_output resp;
struct bnge_fw_msg fw_msg = {};
@@ -127,6 +127,7 @@ static int bng_re_net_ring_free(struct bng_re_dev *rdev,
if (!rdev)
return rc;
+ aux_dev = rdev->aux_dev;
if (!aux_dev)
return rc;
--
2.25.1
next reply other threads:[~2026-01-06 12:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-06 12:03 sunliming [this message]
2026-01-06 13:35 ` [PATCH] RDMA/bng_re: fix variable dereferenced before check in bng_re_net_ring_free() Siva Reddy Kallam
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=20260106120343.54758-1-sunliming@linux.dev \
--to=sunliming@linux.dev \
--cc=error27@gmail.com \
--cc=gg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lkp@intel.com \
--cc=siva.kallam@broadcom.com \
--cc=sunliming@kylinos.cn \
/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.