DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net/xsc: fix uninitialized return value in QP modify
@ 2026-11-10  2:18 Stephen Hemminger
  2026-11-10  7:11 ` Renyong Wan
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2026-11-10  2:18 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, stable, Renyong Wan, Na Na, Rong Qian,
	Xiaoxiong Zhang, Dongwei Xu

If xsc_vfio_modify_qp_status() is called with num <= 0 the loop
is skipped and an uninitialized value is returned.
All current callers pass num = 1, but gcc 15 at -O1 cannot see
that through the dev_ops indirection and reports:

  xsc_vfio.c:491:16: error: 'ret' may be used uninitialized

Initialize ret to 0.

Bugzilla ID: 2099
Fixes: 31e84e37c0b9 ("net/xsc: support VFIO")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/xsc/xsc_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/xsc/xsc_vfio.c b/drivers/net/xsc/xsc_vfio.c
index 0a1e507f7d..bae891cfba 100644
--- a/drivers/net/xsc/xsc_vfio.c
+++ b/drivers/net/xsc/xsc_vfio.c
@@ -449,7 +449,7 @@ xsc_vfio_link_get(struct xsc_dev *xdev, struct rte_eth_link *link)
 static int
 xsc_vfio_modify_qp_status(struct xsc_dev *xdev, uint32_t qpn, int num, int opcode)
 {
-	int i, ret;
+	int i, ret = 0;
 	int in_len, out_len, cmd_len;
 	struct xsc_cmd_modify_qp_mbox_in *in;
 	struct xsc_cmd_modify_qp_mbox_out *out;
-- 
2.53.0


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

* Re: [PATCH] net/xsc: fix uninitialized return value in QP modify
  2026-11-10  2:18 [PATCH] net/xsc: fix uninitialized return value in QP modify Stephen Hemminger
@ 2026-11-10  7:11 ` Renyong Wan
  0 siblings, 0 replies; 2+ messages in thread
From: Renyong Wan @ 2026-11-10  7:11 UTC (permalink / raw)
  To: Stephen Hemminger, dev
  Cc: stable, Na Na, Rong Qian, Xiaoxiong Zhang, Dongwei Xu

On 11/10/2026 10:18 AM, Stephen Hemminger wrote:
> If xsc_vfio_modify_qp_status() is called with num <= 0 the loop
> is skipped and an uninitialized value is returned.
> All current callers pass num = 1, but gcc 15 at -O1 cannot see
> that through the dev_ops indirection and reports:
> 
>    xsc_vfio.c:491:16: error: 'ret' may be used uninitialized
> 
> Initialize ret to 0.
> 
> Bugzilla ID: 2099
> Fixes: 31e84e37c0b9 ("net/xsc: support VFIO")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>   drivers/net/xsc/xsc_vfio.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/xsc/xsc_vfio.c b/drivers/net/xsc/xsc_vfio.c
> index 0a1e507f7d..bae891cfba 100644
> --- a/drivers/net/xsc/xsc_vfio.c
> +++ b/drivers/net/xsc/xsc_vfio.c
> @@ -449,7 +449,7 @@ xsc_vfio_link_get(struct xsc_dev *xdev, struct rte_eth_link *link)
>   static int
>   xsc_vfio_modify_qp_status(struct xsc_dev *xdev, uint32_t qpn, int num, int opcode)
>   {
> -	int i, ret;
> +	int i, ret = 0;
>   	int in_len, out_len, cmd_len;
>   	struct xsc_cmd_modify_qp_mbox_in *in;
>   	struct xsc_cmd_modify_qp_mbox_out *out;

Thanks for the fix, Stephen.

Acked-by: Renyong Wan <wanry@yunsilicon.com>

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

end of thread, other threads:[~2026-11-10  7:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10  2:18 [PATCH] net/xsc: fix uninitialized return value in QP modify Stephen Hemminger
2026-11-10  7:11 ` Renyong Wan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox