From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0F6D642A2F; Tue, 2 May 2023 15:49:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 03C5040ED8; Tue, 2 May 2023 15:49:53 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 95D6D40E2D; Tue, 2 May 2023 15:49:51 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 342CVWwG026305; Tue, 2 May 2023 06:49:50 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=xnv0SJdWJ6SFQioyFbMD8pb+N1FP1NXERiTSKc+iyfI=; b=gLpySb2biVEl3+W6PbzpxtH3LYCv6U86BB/uhdtPzj+kaIpzhn9DdguaFAVxipwKc19n tUeSzM6wC/6/HSG/i9HmiCufMk+fFE/hO/vzv12SAlxl2WVWdmcSKZ5hiCUE5cZgkI2i vKLyhVe8WR0dGkiuBVL/SwX1flDOqSj3Hry1S87fJctjB/vEVMJp8KsMJk/noZr2VkeZ HxCKoleOUDNtvlPLJIlnGn6zkV+DtYlhS5Uy3Z74dfrYA+Dok8W62T1+kAeOOaojc4xG btCeWuMNx1+Ssf6b7nQVar8idsB8MdDhBmKnzEX20hqd8T5n2n28d8UUGupoD1Y7G2E9 KQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qavhehk65-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 02 May 2023 06:49:50 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 2 May 2023 06:49:43 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 2 May 2023 06:49:43 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id BAE5D3F7040; Tue, 2 May 2023 06:49:40 -0700 (PDT) From: To: CC: , , , , Jerin Jacob , Subject: [dpdk-dev] [PATCH v1] examples/ntb: fix build issue with GCC 13 Date: Tue, 2 May 2023 19:19:23 +0530 Message-ID: <20230502134923.3536075-2-jerinj@marvell.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230502134923.3536075-1-jerinj@marvell.com> References: <20230502134923.3536075-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 5ZVyfQNgEYDE4Lnojahh4K6a_W5kdcE5 X-Proofpoint-GUID: 5ZVyfQNgEYDE4Lnojahh4K6a_W5kdcE5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-05-02_08,2023-04-27_01,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Jerin Jacob 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. 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@dpdk.org Signed-off-by: Jerin Jacob --- 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) { printf("Error: Cannot get count of xstats\n"); return; } -- 2.40.1