From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Markus Trippelsdorf <markus@trippelsdorf.de>,
Namhyung Kim <namhyung.kim@lge.com>
Subject: [PATCH v2] perf target: Ignore return value of strerror_r() explicitly
Date: Tue, 3 Jul 2012 10:54:12 +0900 [thread overview]
Message-ID: <1341280452-18919-1-git-send-email-namhyung@kernel.org> (raw)
From: Namhyung Kim <namhyung.kim@lge.com>
Since glibc 2.16 added warn_unused_result (wur) attribute
to the function, we should check it or ignore it explicitly.
Also resets @buf not to access to garbages for an invalid
(negative) @errnum.
Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/target.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/target.c b/tools/perf/util/target.c
index 1064d5b148ad..c3a38918e8b6 100644
--- a/tools/perf/util/target.c
+++ b/tools/perf/util/target.c
@@ -110,8 +110,11 @@ int perf_target__strerror(struct perf_target *target, int errnum,
int idx;
const char *msg;
+ memset(buf, 0, buflen);
+
if (errnum >= 0) {
- strerror_r(errnum, buf, buflen);
+ /* make glibc (>= 2.16) happy */
+ (void)strerror_r(errnum, buf, buflen);
return 0;
}
--
1.7.10.2
reply other threads:[~2012-07-03 1:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1341280452-18919-1-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=linux-kernel@vger.kernel.org \
--cc=markus@trippelsdorf.de \
--cc=mingo@kernel.org \
--cc=namhyung.kim@lge.com \
--cc=paulus@samba.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
all inboxes | Powered by JetHome®