Skip to contentSkip to conversation

octeontx2-af: fix uninitialized variable

PATCH In review [email protected] 2 participants 3 messages Sep 20, 2021

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

PATCH 1/1 octeontx2-af: fix uninitialized variable

From: Tom Rix <[email protected]>

Building with clang 13 reports this error
rvu_nix.c:4600:7: error: variable 'val' is used uninitialized whenever
'if' condition is false

                if (!is_rvu_otx2(rvu))
                    ^~~~~~~~~~~~~~~~~

So initialize val.

Fixes 4b5a3ab17c6c ("octeontx2-af: Hardware configuration for inline IPsec")
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +1 -1
index ea3e03fa55d45c..70431db866b328 100644
@@ -4592,7 +4592,7 @@ static void nix_inline_ipsec_cfg(struct rvu *rvu, struct nix_inline_ipsec_cfg *r
 				 int blkaddr)
 {
 	u8 cpt_idx, cpt_blkaddr;
-	u64 val;
+	u64 val = 0;
 
 	cpt_idx = (blkaddr == BLKADDR_NIX0) ? 0 : 1;
 	if (req->enable) {
Signature · 1 line
2.26.3
#1 lore raw
Quoted 6 lines · On Mon, Sep 20, 2021 at 9:54 AM <[email protected]> wrote:

From: Tom Rix <[email protected]>

Building with clang 13 reports this error
rvu_nix.c:4600:7: error: variable 'val' is used uninitialized whenever
'if' condition is false

Quoted 7 lines
                if (!is_rvu_otx2(rvu))
                    ^~~~~~~~~~~~~~~~~

So initialize val.

Fixes 4b5a3ab17c6c ("octeontx2-af: Hardware configuration for inline IPsec")

Thanks for the patch, but it looks like Colin beat you to the punch. In linux-next, I see:
commit d853f1d3c900 ("octeontx2-af: Fix uninitialized variable val")

Quoted 20 lines
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +1 -2
index ea3e03fa55d45c..70431db866b328 100644
@@ -4592,7 +4592,7 @@ static void nix_inline_ipsec_cfg(struct rvu *rvu, struct nix_inline_ipsec_cfg *r
                                 int blkaddr)
 {
        u8 cpt_idx, cpt_blkaddr;
-       u64 val;
+       u64 val = 0;
 
        cpt_idx = (blkaddr == BLKADDR_NIX0) ? 0 : 1;
        if (req->enable) {
--

2.26.3

Signature · 2 lines
Thanks,
~Nick Desaulniers
author
#2 lore raw
Quoted 9 lines · Nick Desaulniers
Quoted 8 lines · On Mon, Sep 20, 2021 at 9:54 AM <[email protected]> wrote:

From: Tom Rix <[email protected]>

Building with clang 13 reports this error
rvu_nix.c:4600:7: error: variable 'val' is used uninitialized whenever
'if' condition is false

                 if (!is_rvu_otx2(rvu))
                     ^~~~~~~~~~~~~~~~~
Quoted 7 lines
Quoted 4 lines

So initialize val.

Fixes 4b5a3ab17c6c ("octeontx2-af: Hardware configuration for inline IPsec")

Thanks for the patch, but it looks like Colin beat you to the punch. In linux-next, I see:
commit d853f1d3c900 ("octeontx2-af: Fix uninitialized variable val")

No worries, those allyesconfig breaks are easy to find :)

Tom

Quoted 22 lines
Quoted 21 lines
---
  drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +1 -2
index ea3e03fa55d45c..70431db866b328 100644
@@ -4592,7 +4592,7 @@ static void nix_inline_ipsec_cfg(struct rvu *rvu, struct nix_inline_ipsec_cfg *r
                                  int blkaddr)
  {
         u8 cpt_idx, cpt_blkaddr;
-       u64 val;
+       u64 val = 0;
 
         cpt_idx = (blkaddr == BLKADDR_NIX0) ? 0 : 1;
         if (req->enable) {
--

2.26.3