xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: John Thomson <git@johnthomson.fastmail.com.au>
Cc: Juergen Gross <jgross@suse.com>,
	xen-devel@lists.xenproject.org, Wei Liu <wei.liu2@citrix.com>,
	christian.lindig@citrix.com, dave@recoil.org
Subject: Re: [PATCH] tools/ocaml/libs/xc fix gcc-8 format-truncation warning
Date: Tue, 15 May 2018 14:19:43 +0100	[thread overview]
Message-ID: <20180515131942.tbdclricnwolm7rs@citrix.com> (raw)
In-Reply-To: <20180515014843.19642-1-git@johnthomson.fastmail.com.au>

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

  parent reply	other threads:[~2018-05-15 13:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2018-05-15 14:24   ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180515131942.tbdclricnwolm7rs@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=christian.lindig@citrix.com \
    --cc=dave@recoil.org \
    --cc=git@johnthomson.fastmail.com.au \
    --cc=jgross@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).