Skip to contentSkip to conversation

RDMA/bnxt_re: avoid unintialized variable use

PATCH In review Arnd Bergmann 2 participants 2 messages Jun 16, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RDMA/bnxt_re: avoid unintialized variable use

From: Arnd Bergmann <[email protected]>

The newly added opcode variable is not initialized anywhere:

drivers/infiniband/hw/bnxt_re/qplib_rcfw.c:322:18: error: variable 'opcode' is uninitialized when used here [-Werror,-Wuninitialized]

        crsqe->opcode = opcode;

Not sure what the intention was here, but this is clearly pointless, so instead use 0 in place of the variable.

Fixes bcfee4ce3e013 ("RDMA/bnxt_re: remove redundant cmdq_bitmap")

---
This is likely not the correct fix, so treat this as a bug report, the patch is what I applied as a temporary workaround in my randconfig tree.

---
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +1 -2
index bb5aebafe1622..8d349d6a633fa 100644
@@ -285,7 +285,6 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,
 	struct pci_dev *pdev;
 	unsigned long flags;
 	u16 cookie;
-	u8 opcode;
 	u8 *preq;
 
 	cmdq = &rcfw->cmdq;
@@ -319,7 +318,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,
 	crsqe->is_internal_cmd = false;
 	crsqe->is_waiter_alive = true;
 	crsqe->is_in_used = true;
-	crsqe->opcode = opcode;
+	crsqe->opcode = 0;
 
 	crsqe->req_size = __get_cmdq_base_cmd_size(msg->req, msg->req_sz);
 	if (__get_cmdq_base_resp_size(msg->req, msg->req_sz) && msg->sb) {
Signature · 1 line
2.39.2
maintainer
#1 lore raw
Quoted 7 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

The newly added opcode variable is not initialized anywhere:

drivers/infiniband/hw/bnxt_re/qplib_rcfw.c:322:18: error: variable 'opcode' is uninitialized when used here [-Werror,-Wuninitialized]

        crsqe->opcode = opcode;

This is already fixed and merged
https://lore.kernel.org/r/6ad1e44be2b560986da6fdc6b68da606413e9026.1686644105.git.leonro@nvidia.com

Thanks

Quoted 38 lines

Not sure what the intention was here, but this is clearly pointless, so instead use 0 in place of the variable.

Fixes bcfee4ce3e013 ("RDMA/bnxt_re: remove redundant cmdq_bitmap")

---
This is likely not the correct fix, so treat this as a bug report, the patch is what I applied as a temporary workaround in my randconfig tree.

---
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +1 -3
index bb5aebafe1622..8d349d6a633fa 100644
@@ -285,7 +285,6 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,
        struct pci_dev *pdev;
        unsigned long flags;
        u16 cookie;
-       u8 opcode;
        u8 *preq;
 
        cmdq = &rcfw->cmdq;
@@ -319,7 +318,7 @@ static int __send_message(struct bnxt_qplib_rcfw *rcfw,
        crsqe->is_internal_cmd = false;
        crsqe->is_waiter_alive = true;
        crsqe->is_in_used = true;
-       crsqe->opcode = opcode;
+       crsqe->opcode = 0;
 
        crsqe->req_size = __get_cmdq_base_cmd_size(msg->req, msg->req_sz);
        if (__get_cmdq_base_resp_size(msg->req, msg->req_sz) && msg->sb) {
--

2.39.2