From patchwork Tue May 2 13:50:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerin Jacob Kollanukkaran X-Patchwork-Id: 126662 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 40A5242A2F; Tue, 2 May 2023 15:51:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CD20042C76; Tue, 2 May 2023 15:51:02 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 7F44140ED8; Tue, 2 May 2023 15:51:01 +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 342CVYhV026341; Tue, 2 May 2023 06:51:00 -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=ZxnE6W1dT+H6PGBpSQyBXBUOK+SeNblxSI0/Ulk4QTnAqze4y+KXWh5Vr01z3DTCkiFg 9Q30PhBmtF7lTzvTO9uO/B7oUps055wiPgmES4TxGVJV/bIUiTPS+i5fTpJtOeF6Ibmi ple0U0ZoMcVj1PHBNrwEX89L/oX9+T3L86acROjkTUr1zjF6exlmAldqIVgaxbE5DsUd n4e+m+rqex7CAMOpu97PPGaaTVxdMHTMPCg5g6YTclPVGEBGvtpTqgzF9esj+Fz2grpO CGHsnGdqIsmbC5RE+iafP6Ti1wG6UHldm/zYIszwRcLHDMaiA5CZnbnmtHUAEtXrQUPP ZA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qavhehkee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 02 May 2023 06:51:00 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 2 May 2023 06:50:58 -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:50:58 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id AC5A33F7040; Tue, 2 May 2023 06:50:55 -0700 (PDT) From: To: , Jingjing Wu , Junfeng Guo , Xiaoyun Li CC: , , , , Jerin Jacob , Subject: [dpdk-dev] [PATCH v1] examples/ntb: fix build issue with GCC 13 Date: Tue, 2 May 2023 19:20:45 +0530 Message-ID: <20230502135045.3541570-2-jerinj@marvell.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230502135045.3541570-1-jerinj@marvell.com> References: <20230502135045.3541570-1-jerinj@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: FmxX7rlceumkt5IC1myW6fwSr1K3kgZQ X-Proofpoint-GUID: FmxX7rlceumkt5IC1myW6fwSr1K3kgZQ 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 Tested-by: Ali Alnubani --- 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; }