* [PATCH] RDMA/bng_re: fix variable dereferenced before check in bng_re_net_ring_free()
@ 2026-01-06 12:03 sunliming
2026-01-06 13:35 ` Siva Reddy Kallam
0 siblings, 1 reply; 2+ messages in thread
From: sunliming @ 2026-01-06 12:03 UTC (permalink / raw)
To: siva.kallam, gg, leon
Cc: linux-rdma, linux-kernel, sunliming, kernel test robot,
Dan Carpenter
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] RDMA/bng_re: fix variable dereferenced before check in bng_re_net_ring_free()
2026-01-06 12:03 [PATCH] RDMA/bng_re: fix variable dereferenced before check in bng_re_net_ring_free() sunliming
@ 2026-01-06 13:35 ` Siva Reddy Kallam
0 siblings, 0 replies; 2+ messages in thread
From: Siva Reddy Kallam @ 2026-01-06 13:35 UTC (permalink / raw)
To: sunliming
Cc: gg, leon, linux-rdma, linux-kernel, sunliming, kernel test robot,
Dan Carpenter
[-- Attachment #1: Type: text/plain, Size: 1818 bytes --]
On Tue, Jan 6, 2026 at 5:34 PM <sunliming@linux.dev> wrote:
>
> 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;
rdev is valid from the caller. NULL check for rdev can be removed. I
need to do few more changes for
addressing other comments in
https://lore.kernel.org/all/202601010413.sWadrQel-lkp@intel.com/.
I will be pushing a patch soon along with removing if(!rdev). Thanks.
> if (!aux_dev)
> return rc;
>
> --
> 2.25.1
>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5471 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-06 13:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-06 12:03 [PATCH] RDMA/bng_re: fix variable dereferenced before check in bng_re_net_ring_free() sunliming
2026-01-06 13:35 ` Siva Reddy Kallam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox