From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net,
Peter Spreadborough <peter.spreadborough@broadcom.com>
Subject: [PATCH 07/11] net/bnxt: address coverity checked return issues
Date: Wed, 5 Feb 2025 09:20:00 -0800 [thread overview]
Message-ID: <20250205172004.50395-8-ajit.khaparde@broadcom.com> (raw)
In-Reply-To: <20250205172004.50395-1-ajit.khaparde@broadcom.com>
From: Peter Spreadborough <peter.spreadborough@broadcom.com>
This change addresses the CID 449056: Error handling issues (CHECKED_RETURN)
reported by coverity. The changes add return code handling to
address the issue.
Coverity issue: 449056
Signed-off-by: Peter Spreadborough <peter.spreadborough@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/tf_ulp/ulp_mapper.c | 10 +++++++---
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c | 8 +++++++-
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
index 2429ac2f1a..1a68cf5dfd 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c
@@ -3612,9 +3612,13 @@ ulp_mapper_func_cond_list_process(struct bnxt_ulp_mapper_parms *parms,
}
}
/* write the value into result */
- ulp_operand_read(val, res_local + res_size -
- ULP_BITS_2_BYTE_NR(oper_size),
- ULP_BITS_2_BYTE_NR(val_len));
+ if (unlikely(ulp_operand_read(val, res_local + res_size -
+ ULP_BITS_2_BYTE_NR(oper_size),
+ ULP_BITS_2_BYTE_NR(val_len)))) {
+ BNXT_DRV_DBG(ERR,
+ "field idx operand read failed\n");
+ return -EINVAL;
+ }
/* convert the data to cpu format */
*res = tfp_be_to_cpu_64(*res);
diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
index dd5985cd7b..bf3a3deb18 100644
--- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
+++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c
@@ -517,7 +517,13 @@ ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params,
else
svif_type = BNXT_ULP_DRV_FUNC_SVIF;
}
- ulp_port_db_svif_get(params->ulp_ctx, ifindex, svif_type, &svif);
+
+ if (ulp_port_db_svif_get(params->ulp_ctx, ifindex,
+ svif_type, &svif)) {
+ BNXT_DRV_DBG(ERR, "ParseErr:ifindex is not valid\n");
+ return BNXT_TF_RC_ERROR;
+ }
+
svif = rte_cpu_to_be_16(svif);
mask = rte_cpu_to_be_16(mask);
hdr_field = ¶ms->hdr_field[BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX];
--
2.39.5 (Apple Git-154)
next prev parent reply other threads:[~2025-02-05 17:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-05 17:19 [PATCH 00/11] bnxt patch set Ajit Khaparde
2025-02-05 17:19 ` [PATCH 01/11] net/bnxt: disable TruFlow if compressed CQE is set Ajit Khaparde
2025-02-05 17:19 ` [PATCH 02/11] net/bnxt: simplify check for CQE mode Ajit Khaparde
2025-02-05 17:19 ` [PATCH 03/11] net/bnxt: fix Rx handler Ajit Khaparde
2025-02-05 17:19 ` [PATCH 04/11] net/bnxt: set burst handler correctly Ajit Khaparde
2025-02-05 17:19 ` [PATCH 05/11] net/bnxt/truFlow: Fix seg fault when rep are re-attached Ajit Khaparde
2025-02-05 17:19 ` [PATCH 06/11] net/bnxt: address coverity deadcode issue Ajit Khaparde
2025-02-05 17:20 ` Ajit Khaparde [this message]
2025-02-05 17:20 ` [PATCH 08/11] net/bnxt: address coverity overflow issues Ajit Khaparde
2025-02-05 17:20 ` [PATCH 09/11] net/bnxt: address coverity integer " Ajit Khaparde
2025-02-05 17:20 ` [PATCH 10/11] net/bnxt: address coverity uninitialized variables issues Ajit Khaparde
2025-02-05 17:20 ` [PATCH 11/11] net/bnxt: address coverity control flow issues Ajit Khaparde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250205172004.50395-8-ajit.khaparde@broadcom.com \
--to=ajit.khaparde@broadcom.com \
--cc=dev@dpdk.org \
--cc=peter.spreadborough@broadcom.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).