From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Long Wu <long.wu@corigine.com>,
chaoyong.he@corigine.com, stable@dpdk.org,
Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH 1/2] net/nfp: fix checking return value
Date: Tue, 10 Oct 2023 14:17:26 +0800 [thread overview]
Message-ID: <20231010061727.205886-2-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20231010061727.205886-1-chaoyong.he@corigine.com>
From: Long Wu <long.wu@corigine.com>
CI found that calling "rte_pci_write_config" without
checking return value.
Coverity issue: 403100
Fixes: 1fbe51cd9c3a ("net/nfp: extend usage of BAR from 8 to 24")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org
Signed-off-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
drivers/net/nfp/nfpcore/nfp6000_pcie.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/nfp/nfpcore/nfp6000_pcie.c b/drivers/net/nfp/nfpcore/nfp6000_pcie.c
index 13cf523506..a6fd89b6c8 100644
--- a/drivers/net/nfp/nfpcore/nfp6000_pcie.c
+++ b/drivers/net/nfp/nfpcore/nfp6000_pcie.c
@@ -214,8 +214,9 @@ nfp_bar_write(struct nfp_pcie_user *nfp,
rte_read32(nfp->csr + xbar);
} else {
xbar += nfp->dev_info->pcie_cfg_expbar_offset;
- rte_pci_write_config(nfp->pci_dev, &newcfg, sizeof(uint32_t),
- xbar);
+ if (rte_pci_write_config(nfp->pci_dev, &newcfg, sizeof(uint32_t),
+ xbar) < 0)
+ return -EIO;
}
bar->barcfg = newcfg;
@@ -379,7 +380,8 @@ nfp_enable_bars(struct nfp_pcie_user *nfp)
bar = &nfp->bar[0];
bar->lock = true;
- nfp_bar_write(nfp, bar, barcfg_msix_general);
+ if (nfp_bar_write(nfp, bar, barcfg_msix_general) < 0)
+ return -EIO;
/* Sort bars by bit size - use the smallest possible first. */
qsort(&nfp->bar[0], nfp->bars, sizeof(nfp->bar[0]), nfp_cmp_bars);
--
2.39.1
next parent reply other threads:[~2023-10-10 6:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20231010061727.205886-1-chaoyong.he@corigine.com>
2023-10-10 6:17 ` Chaoyong He [this message]
2023-10-10 6:17 ` [PATCH 2/2] net/nfp: fix illegal memory accesses Chaoyong He
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=20231010061727.205886-2-chaoyong.he@corigine.com \
--to=chaoyong.he@corigine.com \
--cc=dev@dpdk.org \
--cc=long.wu@corigine.com \
--cc=oss-drivers@corigine.com \
--cc=peng.zhang@corigine.com \
--cc=stable@dpdk.org \
/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).