Skip to contentSkip to conversation

perf tools: util: remove redundant va_end() in strbuf_addv()

PATCH Applied Mattias Jacobsson 3 participants 3 messages Dec 29, 2018 – Jan 8, 2019 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tools: util: remove redundant va_end() in strbuf_addv()

Each call to va_copy() should have one, and only one, corresponding call to va_end(). In strbuf_addv() some code paths result in va_end() getting called multiple times. Remove the superfluous va_end().

Fixes ce49d8436cff ("perf strbuf: Match va_{add,copy} with va_end")
---
 tools/perf/util/strbuf.c | 1 -
 1 file changed, 1 deletion(-)
tools/perf/util/strbuf.c +0 -1
index 9005fbe0780e..23092fd6451d 100644
@@ -109,7 +109,6 @@ static int strbuf_addv(struct strbuf *sb, const char *fmt, va_list ap)
 			return ret;
 		}
 		len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap_saved);
-		va_end(ap_saved);
 		if (len > strbuf_avail(sb)) {
 			pr_debug("this should not happen, your vsnprintf is broken");
 			va_end(ap_saved);
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw

Em Sat, Dec 29, 2018 at 03:17:50PM +0100, Mattias Jacobsson escreveu:

Quoted 6 lines

Each call to va_copy() should have one, and only one, corresponding call to va_end(). In strbuf_addv() some code paths result in va_end() getting called multiple times. Remove the superfluous va_end().

Fixes ce49d8436cff ("perf strbuf: Match va_{add,copy} with va_end")

Its nice that you included the Fixes tag!

Thanks, applied.

- Arnaldo

Quoted 18 lines
---
 tools/perf/util/strbuf.c | 1 -
 1 file changed, 1 deletion(-)
tools/perf/util/strbuf.c +0 -1
index 9005fbe0780e..23092fd6451d 100644
@@ -109,7 +109,6 @@ static int strbuf_addv(struct strbuf *sb, const char *fmt, va_list ap)
 			return ret;
 		}
 		len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap_saved);
-		va_end(ap_saved);
 		if (len > strbuf_avail(sb)) {
 			pr_debug("this should not happen, your vsnprintf is broken");
 			va_end(ap_saved);
Signature · 1 line
2.20.1
Signature · 1 line
- Arnaldo
#2 lore raw

[tip:perf/urgent] perf strbuf: Remove redundant va_end() in strbuf_addv()

In reply to Mattias Jacobsson
perf strbuf: Remove redundant va_end() in strbuf_addv()
Commit-ID:  099be748865eece21362aee416c350c0b1ae34df
Gitweb:     https://git.kernel.org/tip/099be748865eece21362aee416c350c0b1ae34df
Author:     Mattias Jacobsson <[email protected]>
AuthorDate: Sat, 29 Dec 2018 15:17:50 +0100
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 4 Jan 2019 12:54:49 -0300

perf strbuf: Remove redundant va_end() in strbuf_addv()

Each call to va_copy() should have one, and only one, corresponding call to va_end(). In strbuf_addv() some code paths result in va_end() getting called multiple times. Remove the superfluous va_end().

Cc Jiri Olsa <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Sanskriti Sharma <[email protected]>
Fixes ce49d8436cff ("perf strbuf: Match va_{add,copy} with va_end")
---
 tools/perf/util/strbuf.c | 1 -
 1 file changed, 1 deletion(-)
tools/perf/util/strbuf.c +0 -1
index 9005fbe0780e..23092fd6451d 100644
@@ -109,7 +109,6 @@ static int strbuf_addv(struct strbuf *sb, const char *fmt, va_list ap)
 			return ret;
 		}
 		len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap_saved);
-		va_end(ap_saved);
 		if (len > strbuf_avail(sb)) {
 			pr_debug("this should not happen, your vsnprintf is broken");
 			va_end(ap_saved);