[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1341280452-18919-1-git-send-email-namhyung@kernel.org>
Date: Tue, 3 Jul 2012 10:54:12 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>,
Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Markus Trippelsdorf <markus@...ppelsdorf.de>,
Namhyung Kim <namhyung.kim@....com>
Subject: [PATCH v2] perf target: Ignore return value of strerror_r() explicitly
From: Namhyung Kim <namhyung.kim@....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@...ppelsdorf.de>
Signed-off-by: Namhyung Kim <namhyung@...nel.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists