[PATCH] net/xsc: fix uninitialized return value in QP modify

Renyong Wan wanry at yunsilicon.com
Tue Nov 10 08:11:45 CET 2026


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 at dpdk.org
> 
> Signed-off-by: Stephen Hemminger <stephen at 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 at yunsilicon.com>


More information about the dev mailing list