Skip to contentSkip to conversation

fix coverity reported issues

PATCH Superseded Ajit Khaparde 2 participants 14 messages May 5, 2020 – May 7, 2020 Network drivers

lore
Share & tools
lore
#0 lore raw

cover fix coverity reported issues

Fix issues reported by Coverity.
Note that one issue was reported in internal coverity scan.

Ajit Khaparde (1):
net/bnxt: fix uninitialized variable error

Kishore Padmanabha (1):
net/bnxt: fix overrun of the ulp device params array

 drivers/net/bnxt/tf_core/tf_tbl.c         | 2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.21.1 (Apple Git-122.3)
#1 lore raw

PATCH 1/2 net/bnxt: fix overrun of the ulp device params array

From: Kishore Padmanabha <[email protected]>

Fix a buffer overrun issue spotted by coverity while accessing the array ulp_device_params.

Fixes 313ac35ac701 ("net/bnxt: support ULP session manager init")
---
 drivers/net/bnxt/tf_ulp/ulp_template_db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/ulp_template_db.c +1 -1
index 86384169f..e89aefad4 100644
@@ -321,7 +321,7 @@ struct bnxt_ulp_def_ident_info ulp_def_ident_tbl[] = {
 	}
 };
 
-struct bnxt_ulp_device_params ulp_device_params[] = {
+struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	[BNXT_ULP_DEVICE_ID_WH_PLUS] = {
 		.global_fid_enable       = BNXT_ULP_SYM_YES,
 		.byte_order              = (enum bnxt_ulp_byte_order)
Signature · 1 line
2.21.1 (Apple Git-122.3)
#2 lore raw

Re: [dpdk-dev] [PATCH 1/2] net/bnxt: fix overrun of the ulp device params array

Quoted 4 lines · Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Fix a buffer overrun issue spotted by coverity while accessing the array ulp_device_params.

If it is spotted by coverity, is there a coverity issue id?

Quoted 24 lines
Fixes 313ac35ac701 ("net/bnxt: support ULP session manager init")
---
 drivers/net/bnxt/tf_ulp/ulp_template_db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/ulp_template_db.c +1 -1
index 86384169f..e89aefad4 100644
@@ -321,7 +321,7 @@ struct bnxt_ulp_def_ident_info ulp_def_ident_tbl[] = {
 	}
 };
 
-struct bnxt_ulp_device_params ulp_device_params[] = {
+struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	[BNXT_ULP_DEVICE_ID_WH_PLUS] = {
 		.global_fid_enable       = BNXT_ULP_SYM_YES,
 		.byte_order              = (enum bnxt_ulp_byte_order)
#3 lore raw

Re: [dpdk-dev] [PATCH 1/2] net/bnxt: fix overrun of the ulp device params array

Quoted 8 lines · Ferruh Yigit
Quoted 4 lines · Ajit Khaparde

From: Kishore Padmanabha <[email protected]>

Fix a buffer overrun issue spotted by coverity while accessing the array ulp_device_params.

If it is spotted by coverity, is there a coverity issue id?

Yes. But in an internal scan.
I haven't seen anything reported in this area in the latest coverity report against 20.05-rc1.

Quoted 29 lines

Review

Quoted 11 lines
Fixes 313ac35ac701 ("net/bnxt: support ULP session manager init")
---
 drivers/net/bnxt/tf_ulp/ulp_template_db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/bnxt/tf_ulp/ulp_template_db.c

drivers/net/bnxt/tf_ulp/ulp_template_db.c struct bnxt_ulp_def_ident_info ulp_def_ident_tbl[] =

Quoted 4 lines

index 86384169f..e89aefad4 100644

drivers/net/bnxt/tf_ulp/ulp_template_db.c +0 -0
@@ -321,7 +321,7 @@ struct bnxt_ulp_def_ident_info ulp_def_ident_tbl[] =

{

drivers/net/bnxt/tf_ulp/ulp_template_db.c struct bnxt_ulp_def_ident_info ulp_def_ident_tbl[] = {

Quoted 5 lines
drivers/net/bnxt/tf_ulp/ulp_template_db.c +1 -1
      }
 };
 
-struct bnxt_ulp_device_params ulp_device_params[] = {
+struct bnxt_ulp_device_params

ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {

Quoted 4 lines
drivers/net/bnxt/tf_ulp/ulp_template_db.c +0 -0
      [BNXT_ULP_DEVICE_ID_WH_PLUS] = {
              .global_fid_enable       = BNXT_ULP_SYM_YES,
              .byte_order              = (enum bnxt_ulp_byte_order)
#4 lore raw

Re: [dpdk-dev] [PATCH 1/2] net/bnxt: fix overrun of the ulp device params array

Quoted 9 lines · Ajit Khaparde

On Wed, May 6, 2020 at 2:17 AM Ferruh Yigit <[email protected] <mailto:[email protected]>> wrote:

On 5/5/2020 8:17 PM, Ajit Khaparde wrote:
> From: Kishore Padmanabha <[email protected] <mailto:[email protected]>>
>

Quoted 8 lines

> Fix a buffer overrun issue spotted by coverity while accessing > the array ulp_device_params.

If it is spotted by coverity, is there a coverity issue id?

Yes. But in an internal scan.
I haven't seen anything reported in this area in the latest coverity report against 20.05-rc1.

Thanks for checking, I wonder what is the difference so that it is not in public converity.
Can you please mention in commit log that it is internal coverity, to prevent same confusion later?

Quoted 31 lines
Quoted 6 lines
Fixes 313ac35ac701 ("net/bnxt: support ULP session manager init")
    <mailto:[email protected]>>
    > Reviewed-by: Michael Baucom <[email protected]
    <mailto:[email protected]>>
    > Reviewed-by: Ajit Khaparde <[email protected]
    <mailto:[email protected]>>
    > ---
    >  drivers/net/bnxt/tf_ulp/ulp_template_db.c | 2 +-
    >  1 file changed, 1 insertion(+), 1 deletion(-)
    >
    > diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.c
    b/drivers/net/bnxt/tf_ulp/ulp_template_db.c
    > index 86384169f..e89aefad4 100644
    > --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.c
    > +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.c
    > @@ -321,7 +321,7 @@ struct bnxt_ulp_def_ident_info ulp_def_ident_tbl[] = {
    >       }
    >  };
    > 
    > -struct bnxt_ulp_device_params ulp_device_params[] = {
    > +struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
    >       [BNXT_ULP_DEVICE_ID_WH_PLUS] = {
    >               .global_fid_enable       = BNXT_ULP_SYM_YES,
    >               .byte_order              = (enum bnxt_ulp_byte_order)
    >
#5 lore raw

Re: [dpdk-dev] [PATCH 1/2] net/bnxt: fix overrun of the ulp device params array

Quoted 18 lines · Ferruh Yigit
Quoted 9 lines · Ajit Khaparde

On Wed, May 6, 2020 at 2:17 AM Ferruh Yigit <[email protected] <mailto:[email protected]>> wrote:

On 5/5/2020 8:17 PM, Ajit Khaparde wrote:
> From: Kishore Padmanabha <[email protected] <mailto:[email protected]>>
>

Quoted 7 lines

> Fix a buffer overrun issue spotted by coverity while accessing > the array ulp_device_params.

If it is spotted by coverity, is there a coverity issue id?

Yes. But in an internal scan.
I haven't seen anything reported in this area in the latest coverity

report

Quoted 9 lines
Quoted 1 line

against 20.05-rc1.

Thanks for checking, I wonder what is the difference so that it is not in public
converity.
Can you please mention in commit log that it is internal coverity, to prevent
same confusion later?

Done. Sent a v2 as well.

Quoted 36 lines
Quoted 7 lines
Quoted 7 lines
Fixes 313ac35ac701 ("net/bnxt: support ULP session manager init")
Quoted 15 lines
    <mailto:[email protected]>>
    > Reviewed-by: Michael Baucom <[email protected]
    <mailto:[email protected]>>
    > Reviewed-by: Ajit Khaparde <[email protected]
    <mailto:[email protected]>>
    > ---
    >  drivers/net/bnxt/tf_ulp/ulp_template_db.c | 2 +-
    >  1 file changed, 1 insertion(+), 1 deletion(-)
    >
    > diff --git a/drivers/net/bnxt/tf_ulp/ulp_template_db.c
    b/drivers/net/bnxt/tf_ulp/ulp_template_db.c
    > index 86384169f..e89aefad4 100644
    > --- a/drivers/net/bnxt/tf_ulp/ulp_template_db.c
    > +++ b/drivers/net/bnxt/tf_ulp/ulp_template_db.c
    > @@ -321,7 +321,7 @@ struct bnxt_ulp_def_ident_info

ulp_def_ident_tbl[] = {

Quoted 5 lines

Review

Quoted 5 lines
      }

};

(quoted diff) +1 -1
-struct bnxt_ulp_device_params ulp_device_params[] = {
+struct bnxt_ulp_device_params

ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {

Quoted 5 lines
Quoted 4 lines

[BNXT_ULP_DEVICE_ID_WH_PLUS] = {
.global_fid_enable = BNXT_ULP_SYM_YES,
.byte_order = (enum bnxt_ulp_byte_order)

#6 lore raw

PATCH 2/2 net/bnxt: fix uninitialized variable error

In reply to Ajit Khaparde

Fix uninitialized variable error reported by coverity.

Fixes d33b68154fa4 ("net/bnxt: add tf_core table scope support")

Coverity issue: 357771

---
 drivers/net/bnxt/tf_core/tf_tbl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_core/tf_tbl.c +1 -1
index 93f387e86..d900c9c09 100644
@@ -539,7 +539,7 @@ tf_em_ctx_reg(struct tf *tfp,
 {
 	struct tf_em_ctx_mem_info *ctxp = &tbl_scope_cb->em_ctx_info[dir];
 	struct tf_em_table *tbl;
-	int rc;
+	int rc = 0;
 	int i;
 
 	for (i = KEY0_TABLE; i < MAX_TABLE; i++) {
Signature · 1 line
2.21.1 (Apple Git-122.3)
#7 lore raw

Re: [dpdk-dev] [PATCH 2/2] net/bnxt: fix uninitialized variable error

Quoted 3 lines · Ajit Khaparde

Fix uninitialized variable error reported by coverity.

Fixes d33b68154fa4 ("net/bnxt: add tf_core table scope support")

The commit id and the patch title doesn't exist in next-net (also not int next-net-brcm), I guess you mean [1] but the updated function below ('tf_em_ctx_reg()') even not exist in that commit.

Can you please check the tag again?

[1] net/bnxt: support TruFlow core table scope

Quoted 23 lines

Coverity issue: 357771

---
 drivers/net/bnxt/tf_core/tf_tbl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_core/tf_tbl.c +1 -1
index 93f387e86..d900c9c09 100644
@@ -539,7 +539,7 @@ tf_em_ctx_reg(struct tf *tfp,
 {
 	struct tf_em_ctx_mem_info *ctxp = &tbl_scope_cb->em_ctx_info[dir];
 	struct tf_em_table *tbl;
-	int rc;
+	int rc = 0;
 	int i;
 
 	for (i = KEY0_TABLE; i < MAX_TABLE; i++) {
#8 lore raw

Re: [dpdk-dev] [PATCH 2/2] net/bnxt: fix uninitialized variable error

Quoted 5 lines · Ferruh Yigit
Quoted 3 lines · Ajit Khaparde

Fix uninitialized variable error reported by coverity.

Fixes d33b68154fa4 ("net/bnxt: add tf_core table scope support")
Quoted 8 lines

The commit id and the patch title doesn't exist in next-net (also not int next-net-brcm), I guess you mean [1] but the updated function below ('tf_em_ctx_reg()') even not exist in that commit.

Can you please check the tag again?

[1] net/bnxt: support TruFlow core table scope

Yes [1] is the correct commit.
dba3ca8b304f ("net/bnxt: support TruFlow core table scope").

Quoted 27 lines

Review

Quoted 11 lines

Coverity issue: 357771

---
 drivers/net/bnxt/tf_core/tf_tbl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/bnxt/tf_core/tf_tbl.c

Quoted 13 lines

index 93f387e86..d900c9c09 100644

drivers/net/bnxt/tf_core/tf_tbl.c +1 -1
@@ -539,7 +539,7 @@ tf_em_ctx_reg(struct tf *tfp,
 {
      struct tf_em_ctx_mem_info *ctxp = &tbl_scope_cb->em_ctx_info[dir];
      struct tf_em_table *tbl;
-     int rc;
+     int rc = 0;
      int i;
 
      for (i = KEY0_TABLE; i < MAX_TABLE; i++) {
#9 lore raw

Re: [dpdk-dev] [PATCH 2/2] net/bnxt: fix uninitialized variable error

Quoted 14 lines · Ajit Khaparde

On Wed, May 6, 2020 at 2:14 AM Ferruh Yigit <[email protected] <mailto:[email protected]>> wrote:

On 5/5/2020 8:17 PM, Ajit Khaparde wrote:
> Fix uninitialized variable error reported by coverity. >
> Fixes: d33b68154fa4 ("net/bnxt: add tf_core table scope support")

The commit id and the patch title doesn't exist in next-net (also not int next-net-brcm), I guess you mean [1] but the updated function below ('tf_em_ctx_reg()') even not exist in that commit.

Quoted 6 lines

Can you please check the tag again?

[1] net/bnxt: support TruFlow core table scope

Yes [1] is the correct commit. dba3ca8b304f("net/bnxt: support TruFlow core table scope").

Using following after offline discussion:

Fixes 69c410b8448d ("net/bnxt: support EM/EEM")
Quoted 31 lines

Quoted 3 lines

Coverity issue: 357771

    <mailto:[email protected]>>
    > Reviewed-by: Somnath Kotur <[email protected]
    <mailto:[email protected]>>
    > Reviewed-by: Randy Schacher <[email protected]
    <mailto:[email protected]>>
    > ---
    >  drivers/net/bnxt/tf_core/tf_tbl.c | 2 +-
    >  1 file changed, 1 insertion(+), 1 deletion(-)
    >
    > diff --git a/drivers/net/bnxt/tf_core/tf_tbl.c
    b/drivers/net/bnxt/tf_core/tf_tbl.c
    > index 93f387e86..d900c9c09 100644
    > --- a/drivers/net/bnxt/tf_core/tf_tbl.c
    > +++ b/drivers/net/bnxt/tf_core/tf_tbl.c
    > @@ -539,7 +539,7 @@ tf_em_ctx_reg(struct tf *tfp,
    >  {
    >       struct tf_em_ctx_mem_info *ctxp = &tbl_scope_cb->em_ctx_info[dir];
    >       struct tf_em_table *tbl;
    > -     int rc;
    > +     int rc = 0;
    >       int i;
    > 
    >       for (i = KEY0_TABLE; i < MAX_TABLE; i++) {
    >
#10 lore raw
In reply to Ajit Khaparde
Quoted 3 lines · Ajit Khaparde

Fix issues reported by Coverity.
Note that one issue was reported in internal coverity scan.

Patches applied to dpdk-next-net-brcm.

Quoted 15 lines

Ajit Khaparde (1):
net/bnxt: fix uninitialized variable error

Kishore Padmanabha (1):
net/bnxt: fix overrun of the ulp device params array

 drivers/net/bnxt/tf_core/tf_tbl.c         | 2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
2.21.1 (Apple Git-122.3)

#11 lore raw

v2 cover fix coverity reported issues

In reply to Ajit Khaparde

Fix issues reported by Coverity.
Note that one issue addressed by patch [1/2] was reported in internal coverity scan.

v1->v2: mention that one of the issue was reported in internal scan.

Ajit Khaparde (1):
net/bnxt: fix uninitialized variable error

Kishore Padmanabha (1):
net/bnxt: fix overrun of the ulp device params array

 drivers/net/bnxt/tf_core/tf_tbl.c         | 2 +-
 drivers/net/bnxt/tf_ulp/ulp_template_db.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.21.1 (Apple Git-122.3)
#12 lore raw

PATCH v2 1/2 net/bnxt: fix overrun of the ulp device params array

From: Kishore Padmanabha <[email protected]>

Fix a buffer overrun issue spotted by coverity while accessing the array ulp_device_params.
Note that the issue was observed in an internal Coverity scan.

Fixes 313ac35ac701 ("net/bnxt: support ULP session manager init")
---
 drivers/net/bnxt/tf_ulp/ulp_template_db.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_ulp/ulp_template_db.c +1 -1
index 86384169f..e89aefad4 100644
@@ -321,7 +321,7 @@ struct bnxt_ulp_def_ident_info ulp_def_ident_tbl[] = {
 	}
 };
 
-struct bnxt_ulp_device_params ulp_device_params[] = {
+struct bnxt_ulp_device_params ulp_device_params[BNXT_ULP_DEVICE_ID_LAST] = {
 	[BNXT_ULP_DEVICE_ID_WH_PLUS] = {
 		.global_fid_enable       = BNXT_ULP_SYM_YES,
 		.byte_order              = (enum bnxt_ulp_byte_order)
Signature · 1 line
2.21.1 (Apple Git-122.3)
#13 lore raw

PATCH v2 2/2 net/bnxt: fix uninitialized variable error

In reply to Ajit Khaparde

Fix uninitialized variable error reported by coverity.

Fixes d33b68154fa4 ("net/bnxt: add tf_core table scope support")

Coverity issue: 357771

---
 drivers/net/bnxt/tf_core/tf_tbl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bnxt/tf_core/tf_tbl.c +1 -1
index 93f387e86..d900c9c09 100644
@@ -539,7 +539,7 @@ tf_em_ctx_reg(struct tf *tfp,
 {
 	struct tf_em_ctx_mem_info *ctxp = &tbl_scope_cb->em_ctx_info[dir];
 	struct tf_em_table *tbl;
-	int rc;
+	int rc = 0;
 	int i;
 
 	for (i = KEY0_TABLE; i < MAX_TABLE; i++) {
Signature · 1 line
2.21.1 (Apple Git-122.3)