From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 901165F2D for ; Thu, 22 Mar 2018 19:18:49 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Mar 2018 11:18:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,345,1517904000"; d="scan'208";a="37272402" Received: from silpixa00399777.ir.intel.com (HELO silpixa00399777.ger.corp.intel.com) ([10.237.222.236]) by orsmga003.jf.intel.com with ESMTP; 22 Mar 2018 11:18:46 -0700 From: Ferruh Yigit To: Jacek Siuda , Tomasz Duszynski , Dmitri Epshtein , Natalie Samsonov , Jianbo Liu Cc: dev@dpdk.org, Ferruh Yigit Date: Thu, 22 Mar 2018 18:18:47 +0000 Message-Id: <20180322181847.74246-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.13.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/mrvl: fix build error with gcc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2018 18:18:49 -0000 gcc version: aarch64-linux-gnu-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011 build error: CC mrvl_qos.o .../drivers/net/mrvl/mrvl_qos.c: In function ‘mrvl_configure_rxqs’: .../drivers/net/mrvl/mrvl_qos.c:679:17: error: ‘sprintf’ may write a terminating nul past the end of the destination [-Werror=format-overflow=] sprintf(match, "policer-%d:%d\n", priv->pp_id, priv->ppio_id); ^~~~~~~~~~~~~~~~~ .../drivers/net/mrvl/mrvl_qos.c:679:2: note: ‘sprintf’ output between 13 and 17 bytes into a destination of size 16 sprintf(match, "policer-%d:%d\n", priv->pp_id, priv->ppio_id); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixed by replacing sprintf to snprintf. Fixes: 8860fd7b70f0 ("net/mrvl: add ingress policer support") Cc: tdu@semihalf.com Signed-off-by: Ferruh Yigit --- --- drivers/net/mrvl/mrvl_qos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/mrvl/mrvl_qos.c b/drivers/net/mrvl/mrvl_qos.c index e9c4531fd..741d3da7a 100644 --- a/drivers/net/mrvl/mrvl_qos.c +++ b/drivers/net/mrvl/mrvl_qos.c @@ -676,7 +676,8 @@ setup_policer(struct mrvl_priv *priv, struct pp2_cls_plcr_params *params) char match[16]; int ret; - sprintf(match, "policer-%d:%d\n", priv->pp_id, priv->ppio_id); + snprintf(match, sizeof(match), "policer-%d:%d\n", + priv->pp_id, priv->ppio_id); params->match = match; ret = pp2_cls_plcr_init(params, &priv->policer); -- 2.13.6