From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomasz Duszynski Subject: Re: [PATCH] net/mrvl: fix build error with gcc Date: Fri, 23 Mar 2018 08:52:29 +0100 Message-ID: <20180323075229.GA22697@sh> References: <20180322181847.74246-1-ferruh.yigit@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Jacek Siuda , Tomasz Duszynski , Dmitri Epshtein , Natalie Samsonov , Jianbo Liu , dev@dpdk.org To: Ferruh Yigit Return-path: Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by dpdk.org (Postfix) with ESMTP id B3A081B010 for ; Fri, 23 Mar 2018 08:52:31 +0100 (CET) Received: by mail-lf0-f68.google.com with SMTP id g203-v6so16910170lfg.11 for ; Fri, 23 Mar 2018 00:52:31 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20180322181847.74246-1-ferruh.yigit@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Mar 22, 2018 at 06:18:47PM +0000, Ferruh Yigit wrote: > 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 =E2=80=98mrvl_configure_rxqs= =E2=80=99: > .../drivers/net/mrvl/mrvl_qos.c:679:17: > error: =E2=80=98sprintf=E2=80=99 may write a terminating nul past the e= nd of the > destination [-Werror=3Dformat-overflow=3D] > sprintf(match, "policer-%d:%d\n", priv->pp_id, priv->ppio_id); > ^~~~~~~~~~~~~~~~~ > .../drivers/net/mrvl/mrvl_qos.c:679:2: > note: =E2=80=98sprintf=E2=80=99 output between 13 and 17 bytes into a d= estination > 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 =3D match; > > ret =3D pp2_cls_plcr_init(params, &priv->policer); > -- > 2.13.6 > Acked-by: Tomasz Duszynski -- - Tomasz Duszy=C5=84ski