Soft Patch Panel
 help / color / mirror / Atom feed
* [spp] [PATCH] spp_vf: change char length to avoid compile error
@ 2018-04-16  2:26 Kenta Shinohara
  2018-04-16  6:07 ` Yasufumi Ogawa
  0 siblings, 1 reply; 3+ messages in thread
From: Kenta Shinohara @ 2018-04-16  2:26 UTC (permalink / raw)
  To: spp; +Cc: Kenta Shinohara

Change character length of SPP_CMD_VALUE_BUFSZ to avoid compile error
on gcc-7.

Signed-off-by: Kenta Shinohara <shinohara.kenta@lab.ntt.co.jp>
---
 src/vf/command_dec.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
index 9f7bada..f9d2120 100644
--- a/src/vf/command_dec.h
+++ b/src/vf/command_dec.h
@@ -52,7 +52,7 @@
 #define SPP_CMD_NAME_BUFSZ  32
 
 /** command value string buffer size (include null char) */
-#define SPP_CMD_VALUE_BUFSZ 128
+#define SPP_CMD_VALUE_BUFSZ 111
 
 /** string that specify unused */
 #define SPP_CMD_UNUSE "unuse"
-- 
2.7.4

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

* Re: [spp] [PATCH] spp_vf: change char length to avoid compile error
  2018-04-16  2:26 [spp] [PATCH] spp_vf: change char length to avoid compile error Kenta Shinohara
@ 2018-04-16  6:07 ` Yasufumi Ogawa
  2018-05-03 15:53   ` Ferruh Yigit
  0 siblings, 1 reply; 3+ messages in thread
From: Yasufumi Ogawa @ 2018-04-16  6:07 UTC (permalink / raw)
  To: Kenta Shinohara, spp, ferruh.yigit

On 2018/04/16 11:26, Kenta Shinohara wrote:
> Change character length of SPP_CMD_VALUE_BUFSZ to avoid compile error
> on gcc-7.
> 
> Signed-off-by: Kenta Shinohara <shinohara.kenta@lab.ntt.co.jp>
Hi Kenta,

Thank you for your contribution!

I also tried to compile met the same problem on Ubuntu 17.10 and gcc ver 7.1. It seems that checking is more strict in gcc ver 
7.1 while ver 5.4 on Ubuntu 16.04 LTS. Your patch is working on both of Ubuntu16.04 and 17.10.

spp/src/vf/command_proc.c:231:37: error: ‘%s’ directive writing up to 127 bytes into a region of size 112 [-Werror=format-overflow=]
    sprintf(message, "unknown command(%s)", decode_error->value);
                                      ^~    ~~~~~~~~~~~~
In file included from /usr/include/stdio.h:862:0,
                  from /home/ubuntu/dpdk-home/dpdk/x86_64-native-linuxapp-gcc/include/rte_log.h:50,
                  from /home/ubuntu/dpdk-home/spp/src/vf/command_proc.c:4:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 18 and 145 bytes into a 
destination of size 128
    return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I think it is acceptable to change buf size from 128 to 111 because command is not so long to exceed over 100 chars in spp_vf.

Acked-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
> ---
>   src/vf/command_dec.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/vf/command_dec.h b/src/vf/command_dec.h
> index 9f7bada..f9d2120 100644
> --- a/src/vf/command_dec.h
> +++ b/src/vf/command_dec.h
> @@ -52,7 +52,7 @@
>   #define SPP_CMD_NAME_BUFSZ  32
>   
>   /** command value string buffer size (include null char) */
> -#define SPP_CMD_VALUE_BUFSZ 128
> +#define SPP_CMD_VALUE_BUFSZ 111
>   
>   /** string that specify unused */
>   #define SPP_CMD_UNUSE "unuse"
> 

-- 
Yasufumi Ogawa
NTT Network Service Systems Labs

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

* Re: [spp] [PATCH] spp_vf: change char length to avoid compile error
  2018-04-16  6:07 ` Yasufumi Ogawa
@ 2018-05-03 15:53   ` Ferruh Yigit
  0 siblings, 0 replies; 3+ messages in thread
From: Ferruh Yigit @ 2018-05-03 15:53 UTC (permalink / raw)
  To: Yasufumi Ogawa, Kenta Shinohara, spp

On 4/16/2018 7:07 AM, Yasufumi Ogawa wrote:
> On 2018/04/16 11:26, Kenta Shinohara wrote:
>> Change character length of SPP_CMD_VALUE_BUFSZ to avoid compile error
>> on gcc-7.
>>
>> Signed-off-by: Kenta Shinohara <shinohara.kenta@lab.ntt.co.jp>
> Hi Kenta,
> 
> Thank you for your contribution!
> 
> I also tried to compile met the same problem on Ubuntu 17.10 and gcc ver 7.1. It seems that checking is more strict in gcc ver 
> 7.1 while ver 5.4 on Ubuntu 16.04 LTS. Your patch is working on both of Ubuntu16.04 and 17.10.
> 
> spp/src/vf/command_proc.c:231:37: error: ‘%s’ directive writing up to 127 bytes into a region of size 112 [-Werror=format-overflow=]
>     sprintf(message, "unknown command(%s)", decode_error->value);
>                                       ^~    ~~~~~~~~~~~~
> In file included from /usr/include/stdio.h:862:0,
>                   from /home/ubuntu/dpdk-home/dpdk/x86_64-native-linuxapp-gcc/include/rte_log.h:50,
>                   from /home/ubuntu/dpdk-home/spp/src/vf/command_proc.c:4:
> /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 18 and 145 bytes into a 
> destination of size 128
>     return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
>            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>         __bos (__s), __fmt, __va_arg_pack ());
>         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> I think it is acceptable to change buf size from 128 to 111 because command is not so long to exceed over 100 chars in spp_vf.
> 
> Acked-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

Applied, thanks.

(The build error and comment to change buf size to 111 added to commit log)

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

end of thread, other threads:[~2018-05-03 15:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-16  2:26 [spp] [PATCH] spp_vf: change char length to avoid compile error Kenta Shinohara
2018-04-16  6:07 ` Yasufumi Ogawa
2018-05-03 15:53   ` 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).