xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wl@xen.org>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>, Wei Liu <wl@xen.org>,
	Ian Jackson <Ian.Jackson@citrix.com>
Subject: Re: [Xen-devel] [PATCH] tools/xenstat: Fix -Wformat-truncation= issue
Date: Wed, 14 Aug 2019 10:37:47 +0000	[thread overview]
Message-ID: <20190814103747.ck6uskrkdpbee7ez@liuwe-gateway.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net> (raw)
In-Reply-To: <20190813135211.13668-1-andrew.cooper3@citrix.com>

On Tue, Aug 13, 2019 at 02:52:11PM +0100, Andrew Cooper wrote:
> Building with GCC 8.3 on Buster identifies:
> 
>   src/xenstat_linux.c: In function 'xenstat_collect_networks':
>   src/xenstat_linux.c:307:32: warning: 'snprintf' output may be truncated before
>   the last format character [-Wformat-truncation=]
>     snprintf(devNoBridge, 16, "p%s", devBridge);
>                                   ^
>   src/xenstat_linux.c:307:2: note: 'snprintf' output between 2 and 17 bytes into
>   a destination of size 16
>     snprintf(devNoBridge, 16, "p%s", devBridge);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> devNoBridge[] needs one charater more than devBridge[], so allocate one byte
> more.  Replace a raw 16 in the snprintf() call with a sizeof() expression
> instead.
> 
> Finally, libxenstat, unlike most of the rest of the Xen, doesn't use -Werror
> which is why this issue went unnoticed in CI.  Fix this.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Wei Liu <wl@xen.org>

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

      parent reply	other threads:[~2019-08-14 10:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13 13:52 [Xen-devel] [PATCH] tools/xenstat: Fix -Wformat-truncation= issue Andrew Cooper
2019-08-13 14:21 ` [Xen-devel] [PATCH 2/1] toos/xenstat: Fix -Wunused-function issue Andrew Cooper
2019-08-14 10:38   ` Wei Liu
2019-08-14 10:37 ` Wei Liu [this message]

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=20190814103747.ck6uskrkdpbee7ez@liuwe-gateway.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net \
    --to=wl@xen.org \
    --cc=Ian.Jackson@citrix.com \
    --cc=andrew.cooper3@citrix.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).