From: Masami Hiramatsu Date: Mon, 7 Dec 2009 17:00:53 +0000 (-0500) Subject: perf probe: Check e_snprintf() format string X-Git-Tag: v2.6.33-rc1~306^2~28 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=849884508ecbe2d220131840e4cc7c32ca24ebe3;p=~emulex%2Finfiniband.git perf probe: Check e_snprintf() format string Check e_snprintf() format string by gcc, and fix a bug of e_snprintf() caller. Signed-off-by: Masami Hiramatsu Cc: systemtap Cc: DLE Cc: Frederic Weisbecker Cc: Arnaldo Carvalho de Melo Cc: Frederic Weisbecker LKML-Reference: <20091207170053.19230.7690.stgit@dhcp-100-2-132.bos.redhat.com> Signed-off-by: Ingo Molnar --- diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index de0d91385c9..88e18044993 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c @@ -47,6 +47,9 @@ #define semantic_error(msg ...) die("Semantic error :" msg) /* If there is no space to write, returns -E2BIG. */ +static int e_snprintf(char *str, size_t size, const char *format, ...) + __attribute__((format(printf, 3, 4))); + static int e_snprintf(char *str, size_t size, const char *format, ...) { int ret; @@ -258,7 +261,7 @@ int synthesize_perf_probe_event(struct probe_point *pp) ret = e_snprintf(buf, MAX_CMDLEN, "%s%s%s%s", pp->function, offs, pp->retprobe ? "%return" : "", line); else - ret = e_snprintf(buf, MAX_CMDLEN, "%s%s%s%s", pp->file, line); + ret = e_snprintf(buf, MAX_CMDLEN, "%s%s", pp->file, line); if (ret <= 0) goto error; len = ret;