[dpdk-dev] [PATCH v1] examples/ntb: fix build issue with GCC 13

Guo, Junfeng junfeng.guo at intel.com
Thu May 4 10:36:08 CEST 2023



> -----Original Message-----
> From: jerinj at marvell.com <jerinj at marvell.com>
> Sent: Tuesday, May 2, 2023 21:51
> To: dev at dpdk.org; Wu, Jingjing <jingjing.wu at intel.com>; Guo, Junfeng
> <junfeng.guo at intel.com>; Li, Xiaoyun <xiaoyun.li at intel.com>
> Cc: thomas at monjalon.net; david.marchand at redhat.com;
> ferruh.yigit at xilinx.com; stephen at networkplumber.org; Jerin Jacob
> <jerinj at marvell.com>; stable at dpdk.org
> Subject: [dpdk-dev] [PATCH v1] examples/ntb: fix build issue with GCC 13
> 
> From: Jerin Jacob <jerinj at marvell.com>
> 
> Fix the following build issue by not allowing nb_ids to be zero.
> nb_ids can be zero based on rte_rawdev_xstats_get() API
> documentation but it is not valid for the case when second
> argument is NULL.

Is this the new standard for GCC 13?

> 
> examples/ntb/ntb_fwd.c: In function 'ntb_stats_display':
> examples/ntb/ntb_fwd.c:945:23: error: 'rte_rawdev_xstats_get'
> accessing 8 bytes in a region of size 0 [-Werror=stringop-overflow=]
>   945 | if (nb_ids != rte_rawdev_xstats_get(dev_id, ids, values, nb_ids)) {
>       |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> examples/ntb/ntb_fwd.c:945:23: note: referencing argument 3
> of type 'uint64_t[0]' {aka 'long unsigned int[]'}
> In file included from ../examples/ntb/ntb_fwd.c:17:
> lib/rawdev/rte_rawdev.h:504:1: note: in a call to function
> 'rte_rawdev_xstats_get'
>   504 | rte_rawdev_xstats_get(uint16_t dev_id,
> 
> Fixes: 5194299d6ef5 ("examples/ntb: support more functions")
> Cc: stable at dpdk.org
> Signed-off-by: Jerin Jacob <jerinj at marvell.com>
> ---
>  examples/ntb/ntb_fwd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c
> index f9abed28e4..5489c3b3cd 100644
> --- a/examples/ntb/ntb_fwd.c
> +++ b/examples/ntb/ntb_fwd.c
> @@ -923,7 +923,7 @@ ntb_stats_display(void)
> 
>  	/* Get NTB dev stats and stats names */
>  	nb_ids = rte_rawdev_xstats_names_get(dev_id, NULL, 0);
> -	if (nb_ids  < 0) {
> +	if (nb_ids <= 0) {

Should the one in func ntb_stats_clear also be updated non-zero?

>  		printf("Error: Cannot get count of xstats\n");
>  		return;
>  	}
> --
> 2.40.1



More information about the stable mailing list