From: John Thomson <git@johnthomson.fastmail.com.au>
To: xen-devel@lists.xenproject.org
Cc: george.dunlap@eu.citrix.com,
John Thomson <git@johnthomson.fastmail.com.au>
Subject: [PATCH] tools: xenalyze.c fix format-truncation
Date: Wed, 14 Mar 2018 18:21:24 +1000 [thread overview]
Message-ID: <20180314082124.8755-1-git@johnthomson.fastmail.com.au> (raw)
With gcc optimization enabled by:
tools: detect appropriate debug optimization level
b43501451733193b265de30fd79a764363a2a473
-Wformat-truncation throws warnings
gcc version 7.3.0
xenalyze.c: In function 'find_symbol':
xenalyze.c:382:36: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
snprintf(name, 128, "(%s +%llx)",
^
xenalyze.c:382:5: note: 'snprintf' output between 6 and 144 bytes into a destination of size 128
snprintf(name, 128, "(%s +%llx)",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lastname, offset);
~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
---
tools/xentrace/xenalyze.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
index 5768b54f86..5ed0a12327 100644
--- a/tools/xentrace/xenalyze.c
+++ b/tools/xentrace/xenalyze.c
@@ -358,7 +358,7 @@ char * find_symbol(unsigned long long addr) {
int i;
char * lastname="ZERO";
unsigned long long offset=addr;
- static char name[128];
+ static char name[144];
if(!p) {
name[0]=0;
@@ -379,7 +379,7 @@ char * find_symbol(unsigned long long addr) {
p=p->next;
}
finish:
- snprintf(name, 128, "(%s +%llx)",
+ snprintf(name, 144, "(%s +%llx)",
lastname, offset);
return name;
}
--
2.16.2
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next reply other threads:[~2018-03-14 8:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 8:21 John Thomson [this message]
2018-03-14 10:07 ` [PATCH] tools: xenalyze.c fix format-truncation George Dunlap
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=20180314082124.8755-1-git@johnthomson.fastmail.com.au \
--to=git@johnthomson.fastmail.com.au \
--cc=george.dunlap@eu.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).