diff mbox series

octeontx2-af: fix uninitialized variable

Message ID 20210920165347.164087-1-trix@redhat.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series octeontx2-af: fix uninitialized variable | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers success CCed 14 of 14 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Tom Rix Sept. 20, 2021, 4:53 p.m. UTC
From: Tom Rix <trix@redhat.com>

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")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Nick Desaulniers Sept. 20, 2021, 10:22 p.m. UTC | #1
On Mon, Sep 20, 2021 at 9:54 AM <trix@redhat.com> wrote:
>
> From: Tom Rix <trix@redhat.com>
>
> 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")
> Signed-off-by: Tom Rix <trix@redhat.com>

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")

> ---
>  drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> index ea3e03fa55d45c..70431db866b328 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
> @@ -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
>
Tom Rix Sept. 20, 2021, 11:08 p.m. UTC | #2
On 9/20/21 3:22 PM, Nick Desaulniers wrote:
> On Mon, Sep 20, 2021 at 9:54 AM <trix@redhat.com> wrote:
>> From: Tom Rix <trix@redhat.com>
>>
>> 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")
>> Signed-off-by: Tom Rix <trix@redhat.com>
> 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

>
>> ---
>>   drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
>> index ea3e03fa55d45c..70431db866b328 100644
>> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
>> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
>> @@ -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
>>
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
index ea3e03fa55d45c..70431db866b328 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c
@@ -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) {