DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mrvl: fix build error with gcc
@ 2018-03-22 18:18 Ferruh Yigit
  2018-03-23  7:52 ` Tomasz Duszynski
  0 siblings, 1 reply; 3+ messages in thread
From: Ferruh Yigit @ 2018-03-22 18:18 UTC (permalink / raw)
  To: Jacek Siuda, Tomasz Duszynski, Dmitri Epshtein, Natalie Samsonov,
	Jianbo Liu
  Cc: dev, Ferruh Yigit

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 <ferruh.yigit@intel.com>
---
---
 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/mrvl: fix build error with gcc
  2018-03-22 18:18 [dpdk-dev] [PATCH] net/mrvl: fix build error with gcc Ferruh Yigit
@ 2018-03-23  7:52 ` Tomasz Duszynski
  2018-03-27 19:11   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Tomasz Duszynski @ 2018-03-23  7:52 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Jacek Siuda, Tomasz Duszynski, Dmitri Epshtein, Natalie Samsonov,
	Jianbo Liu, 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 ‘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 <ferruh.yigit@intel.com>
> ---
> ---
>  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
>

Acked-by: Tomasz Duszynski <tdu@semihalf.com>

--
- Tomasz Duszyński

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/mrvl: fix build error with gcc
  2018-03-23  7:52 ` Tomasz Duszynski
@ 2018-03-27 19:11   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2018-03-27 19:11 UTC (permalink / raw)
  To: Tomasz Duszynski
  Cc: Jacek Siuda, Dmitri Epshtein, Natalie Samsonov, Jianbo Liu, dev

On 3/23/2018 7:52 AM, Tomasz Duszynski wrote:
> 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 ‘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 <ferruh.yigit@intel.com>

> Acked-by: Tomasz Duszynski <tdu@semihalf.com>

Squashed into relevant commit in next-net, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-27 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-22 18:18 [dpdk-dev] [PATCH] net/mrvl: fix build error with gcc Ferruh Yigit
2018-03-23  7:52 ` Tomasz Duszynski
2018-03-27 19:11   ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).