All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/ocaml/libs/xc fix gcc-8 format-truncation warning
@ 2018-05-15  1:48 John Thomson
  2018-05-15 13:08 ` Christian Lindig
  2018-05-15 13:19 ` Wei Liu
  0 siblings, 2 replies; 4+ messages in thread
From: John Thomson @ 2018-05-15  1:48 UTC (permalink / raw)
  To: xen-devel; +Cc: christian.lindig, John Thomson, dave

 CC       xenctrl_stubs.o
xenctrl_stubs.c: In function 'failwith_xc':
xenctrl_stubs.c:65:17: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
      "%d: %s: %s", error->code,
                 ^
xenctrl_stubs.c:64:4: note: 'snprintf' output 6 or more bytes (assuming 1029) into a destination of size 1028
    snprintf(error_str, sizeof(error_str),
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      "%d: %s: %s", error->code,
      ~~~~~~~~~~~~~~~~~~~~~~~~~~
      xc_error_code_to_desc(error->code),
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      error->message);
      ~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[8]: *** [/build/xen-git/src/xen/tools/ocaml/libs/xc/../../Makefile.rules:37: xenctrl_stubs.o] Error 1
m

Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index f97070c8b0..d4309ad97e 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -54,7 +54,7 @@
 
 static void Noreturn failwith_xc(xc_interface *xch)
 {
-	char error_str[1028];
+	char error_str[XC_MAX_ERROR_MSG_LEN + 6];
 	if (xch) {
 		const xc_error *error = xc_get_last_error(xch);
 		if (error->code == XC_ERROR_NONE)
-- 
2.17.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] tools/ocaml/libs/xc fix gcc-8 format-truncation warning
  2018-05-15  1:48 [PATCH] tools/ocaml/libs/xc fix gcc-8 format-truncation warning John Thomson
@ 2018-05-15 13:08 ` Christian Lindig
  2018-05-15 13:19 ` Wei Liu
  1 sibling, 0 replies; 4+ messages in thread
From: Christian Lindig @ 2018-05-15 13:08 UTC (permalink / raw)
  To: John Thomson; +Cc: Marcello Seri, Xen-devel, David Scott



> On 15 May 2018, at 02:48, John Thomson <git@johnthomson.fastmail.com.au> wrote:
> 
> CC       xenctrl_stubs.o
> xenctrl_stubs.c: In function 'failwith_xc':
> xenctrl_stubs.c:65:17: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
>      "%d: %s: %s", error->code,
>                 ^
> xenctrl_stubs.c:64:4: note: 'snprintf' output 6 or more bytes (assuming 1029) into a destination of size 1028
>    snprintf(error_str, sizeof(error_str),
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      "%d: %s: %s", error->code,
>      ~~~~~~~~~~~~~~~~~~~~~~~~~~
>      xc_error_code_to_desc(error->code),
>      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      error->message);
>      ~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[8]: *** [/build/xen-git/src/xen/tools/ocaml/libs/xc/../../Makefile.rules:37: xenctrl_stubs.o] Error 1
> m
> 
> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
> ---
> tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
> index f97070c8b0..d4309ad97e 100644
> --- a/tools/ocaml/libs/xc/xenctrl_stubs.c
> +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
> @@ -54,7 +54,7 @@
> 
> static void Noreturn failwith_xc(xc_interface *xch)
> {
> -	char error_str[1028];
> +	char error_str[XC_MAX_ERROR_MSG_LEN + 6];
> 	if (xch) {
> 		const xc_error *error = xc_get_last_error(xch);
> 		if (error->code == XC_ERROR_NONE)
> -- 
> 2.17.0
> 


Acked-by: Christian Lindig <christian.lindig@citrix.com>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] tools/ocaml/libs/xc fix gcc-8 format-truncation warning
  2018-05-15  1:48 [PATCH] tools/ocaml/libs/xc fix gcc-8 format-truncation warning John Thomson
  2018-05-15 13:08 ` Christian Lindig
@ 2018-05-15 13:19 ` Wei Liu
  2018-05-15 14:24   ` Juergen Gross
  1 sibling, 1 reply; 4+ messages in thread
From: Wei Liu @ 2018-05-15 13:19 UTC (permalink / raw)
  To: John Thomson; +Cc: Juergen Gross, xen-devel, Wei Liu, christian.lindig, dave

CC Juergen, I think this should be in 4.11

On Tue, May 15, 2018 at 11:48:43AM +1000, John Thomson wrote:
>  CC       xenctrl_stubs.o
> xenctrl_stubs.c: In function 'failwith_xc':
> xenctrl_stubs.c:65:17: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
>       "%d: %s: %s", error->code,
>                  ^
> xenctrl_stubs.c:64:4: note: 'snprintf' output 6 or more bytes (assuming 1029) into a destination of size 1028
>     snprintf(error_str, sizeof(error_str),
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>       "%d: %s: %s", error->code,
>       ~~~~~~~~~~~~~~~~~~~~~~~~~~
>       xc_error_code_to_desc(error->code),
>       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>       error->message);
>       ~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[8]: *** [/build/xen-git/src/xen/tools/ocaml/libs/xc/../../Makefile.rules:37: xenctrl_stubs.o] Error 1
> m
> 
> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
> ---
>  tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
> index f97070c8b0..d4309ad97e 100644
> --- a/tools/ocaml/libs/xc/xenctrl_stubs.c
> +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
> @@ -54,7 +54,7 @@
>  
>  static void Noreturn failwith_xc(xc_interface *xch)
>  {
> -	char error_str[1028];
> +	char error_str[XC_MAX_ERROR_MSG_LEN + 6];
>  	if (xch) {
>  		const xc_error *error = xc_get_last_error(xch);
>  		if (error->code == XC_ERROR_NONE)
> -- 
> 2.17.0
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [PATCH] tools/ocaml/libs/xc fix gcc-8 format-truncation warning
  2018-05-15 13:19 ` Wei Liu
@ 2018-05-15 14:24   ` Juergen Gross
  0 siblings, 0 replies; 4+ messages in thread
From: Juergen Gross @ 2018-05-15 14:24 UTC (permalink / raw)
  To: Wei Liu, John Thomson; +Cc: xen-devel, christian.lindig, dave

On 15/05/18 15:19, Wei Liu wrote:
> CC Juergen, I think this should be in 4.11
> 
> On Tue, May 15, 2018 at 11:48:43AM +1000, John Thomson wrote:
>>  CC       xenctrl_stubs.o
>> xenctrl_stubs.c: In function 'failwith_xc':
>> xenctrl_stubs.c:65:17: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
>>       "%d: %s: %s", error->code,
>>                  ^
>> xenctrl_stubs.c:64:4: note: 'snprintf' output 6 or more bytes (assuming 1029) into a destination of size 1028
>>     snprintf(error_str, sizeof(error_str),
>>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>       "%d: %s: %s", error->code,
>>       ~~~~~~~~~~~~~~~~~~~~~~~~~~
>>       xc_error_code_to_desc(error->code),
>>       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>       error->message);
>>       ~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>> make[8]: *** [/build/xen-git/src/xen/tools/ocaml/libs/xc/../../Makefile.rules:37: xenctrl_stubs.o] Error 1
>> m
>>
>> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>

Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-15  1:48 [PATCH] tools/ocaml/libs/xc fix gcc-8 format-truncation warning John Thomson
2018-05-15 13:08 ` Christian Lindig
2018-05-15 13:19 ` Wei Liu
2018-05-15 14:24   ` Juergen Gross

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.