DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] net/xsc: check possible null pointer dereference
  2025-02-25  2:48 [PATCH 0/2] net/xsc: Resolve warnings from PVS Renyong Wan
@ 2025-02-25  2:48 ` Renyong Wan
  2025-02-25  2:48 ` [PATCH 2/2] net/xsc: suppress assign the same value warning Renyong Wan
  1 sibling, 0 replies; 3+ messages in thread
From: Renyong Wan @ 2025-02-25  2:48 UTC (permalink / raw)
  To: dev; +Cc: thomas, stephen, qianr, nana, zhangxx, xudw, jacky, weihg, zhenghy

This issue was reported by PVS studio, described as:
https://pvs-studio.com/en/docs/warnings/v522/

Signed-off-by: Rong Qian <qianr@yunsilicon.com>
Signed-off-by: Renyong Wan <wanry@yunsilicon.com>
---
 drivers/net/xsc/xsc_rx.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/xsc/xsc_rx.c b/drivers/net/xsc/xsc_rx.c
index a702b9592b..0100ccdcfd 100644
--- a/drivers/net/xsc/xsc_rx.c
+++ b/drivers/net/xsc/xsc_rx.c
@@ -308,7 +308,9 @@ xsc_rss_qp_create(struct xsc_ethdev_priv *priv, int port_id)
 	in->req_len = rte_cpu_to_be_32(cmd_len);
 
 	for (i = 0; i < priv->num_rq; i++) {
-		rxq_data = (*priv->rxqs)[i];
+		rxq_data = xsc_rxq_get(priv, i);
+		if (rxq_data == NULL)
+			return -EINVAL;
 		req = (struct xsc_cmd_create_qp_request *)(&in->data[0] + entry_len * i);
 		req->input_qpn = rte_cpu_to_be_16(0); /* useless for eth */
 		req->pa_num = rte_cpu_to_be_16(pa_num);
@@ -348,6 +350,8 @@ xsc_rss_qp_create(struct xsc_ethdev_priv *priv, int port_id)
 
 	for (i = 0; i < priv->num_rq; i++) {
 		rxq_data = xsc_rxq_get(priv, i);
+		if (rxq_data == NULL)
+			return -EINVAL;
 		rxq_data->wqes = rxq_data->rq_pas->addr;
 		if (!xsc_dev_is_vf(xdev))
 			rxq_data->rq_db = (uint32_t *)((uint8_t *)xdev->bar_addr +
-- 
2.25.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] net/xsc: suppress assign the same value warning
  2025-02-25  2:48 [PATCH 0/2] net/xsc: Resolve warnings from PVS Renyong Wan
  2025-02-25  2:48 ` [PATCH 1/2] net/xsc: check possible null pointer dereference Renyong Wan
@ 2025-02-25  2:48 ` Renyong Wan
  1 sibling, 0 replies; 3+ messages in thread
From: Renyong Wan @ 2025-02-25  2:48 UTC (permalink / raw)
  To: dev; +Cc: thomas, stephen, qianr, nana, zhangxx, xudw, jacky, weihg, zhenghy

This issue was reported by PVS studio, described as:
https://pvs-studio.com/en/docs/warnings/v1048/

This warning is harmless since both structs have the same size.
The tool is just being annoying, so we should suppress it.

Signed-off-by: Rong Qian <qianr@yunsilicon.com>
Signed-off-by: Renyong Wan <wanry@yunsilicon.com>
---
 drivers/net/xsc/xsc_vfio_mbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/xsc/xsc_vfio_mbox.c b/drivers/net/xsc/xsc_vfio_mbox.c
index c465679527..3c8bb54601 100644
--- a/drivers/net/xsc/xsc_vfio_mbox.c
+++ b/drivers/net/xsc/xsc_vfio_mbox.c
@@ -572,7 +572,7 @@ xsc_vfio_mbox_init(struct xsc_dev *xdev)
 	cmdq->req_lay = cmdq->req_mz->addr;
 
 	snprintf(name, RTE_MEMZONE_NAMESIZE, "%s_cmd_cq", xdev->pci_dev->device.name);
-	size = (1 << XSC_CMDQ_DEPTH_LOG) * sizeof(struct xsc_cmdq_rsp_layout);
+	size = (1 << XSC_CMDQ_DEPTH_LOG) * sizeof(struct xsc_cmdq_rsp_layout); /* -V1048 */
 	cmdq->rsp_mz = rte_memzone_reserve_aligned(name,
 						   size, SOCKET_ID_ANY,
 						   RTE_MEMZONE_IOVA_CONTIG,
-- 
2.25.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 0/2] net/xsc: Resolve warnings from PVS
@ 2025-02-25  2:48 Renyong Wan
  2025-02-25  2:48 ` [PATCH 1/2] net/xsc: check possible null pointer dereference Renyong Wan
  2025-02-25  2:48 ` [PATCH 2/2] net/xsc: suppress assign the same value warning Renyong Wan
  0 siblings, 2 replies; 3+ messages in thread
From: Renyong Wan @ 2025-02-25  2:48 UTC (permalink / raw)
  To: dev; +Cc: thomas, stephen, qianr, nana, zhangxx, xudw, jacky, weihg, zhenghy

This patch series resolves two warnings reported by PVS studio.

---
Renyong Wan (2):
  net/xsc: check possible null pointer dereference
  net/xsc: suppress assign the same value warning

 drivers/net/xsc/xsc_rx.c        | 6 +++++-
 drivers/net/xsc/xsc_vfio_mbox.c | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

-- 
2.25.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-25  2:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-25  2:48 [PATCH 0/2] net/xsc: Resolve warnings from PVS Renyong Wan
2025-02-25  2:48 ` [PATCH 1/2] net/xsc: check possible null pointer dereference Renyong Wan
2025-02-25  2:48 ` [PATCH 2/2] net/xsc: suppress assign the same value warning Renyong Wan

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