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 3437542A5B; Thu, 4 May 2023 10:53:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B702241144; Thu, 4 May 2023 10:53:55 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id DC4DD410DC; Thu, 4 May 2023 10:53:53 +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 343MkQd9012197; Thu, 4 May 2023 01:53:51 -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=ouOh/I8fJkNk77980Ln8gI3Wpql744PzX1rF2j5/+1g=; b=UsspfJqwuv1x44qWbKFetwYe46mk/sk0V30Q/x17nVo6K32tom9hCQrINtMFGlm8Peox wF1pr3IYjj+Jh56dKbpQG8ENsgAsb5/e2MG835BZY7ll2GGbNVv/JUwJqlem1EFtjX3l c9nN2CCeHsyxlBv3zIztTirygWj6xzCXsL5izo6bH8e1FnUT/8u24WqyLkAiEVx8AztH Kq9ZeIvvQSm2XLvnli5LwaTZYQzDXZGdO0tyv3WFAR5MorIRm1s7WSj8Wc4XQIOo1iZH WuO1A5ZQ2pXqkuyFoKVfeVL/CTBNaOjwgRfAlOGHTgSVk/XulSeJA1/EfuD9Qw/wjky1 pA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qc0pq9pdg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 04 May 2023 01:53:50 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 4 May 2023 01:53:49 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 4 May 2023 01:53:49 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 87CF83F7066; Thu, 4 May 2023 01:53:46 -0700 (PDT) From: To: , Jingjing Wu , Junfeng Guo , Xiaoyun Li CC: , , , Jerin Jacob , , Ali Alnubani Subject: [dpdk-dev] [PATCH v2] examples/ntb: fix build issue with GCC 13 Date: Thu, 4 May 2023 14:23:37 +0530 Message-ID: <20230504085337.3446264-1-jerinj@marvell.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230502135045.3541570-2-jerinj@marvell.com> References: <20230502135045.3541570-2-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: T0L-RVCcsbAOa-Tfa-SAFDT3yQiXRZoK X-Proofpoint-ORIG-GUID: T0L-RVCcsbAOa-Tfa-SAFDT3yQiXRZoK 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-04_05,2023-05-03_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 Tested-by: Ali Alnubani --- v2: - Apply the same fix for ntb_stats_clear()(Junfeng) examples/ntb/ntb_fwd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c index f9abed28e4..585aad9d70 100644 --- a/examples/ntb/ntb_fwd.c +++ b/examples/ntb/ntb_fwd.c @@ -865,7 +865,7 @@ ntb_stats_clear(void) /* Clear NTB dev stats */ 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; } @@ -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