diff options
-rw-r--r-- | tools/perf/builtin-report.c | 2 | ||||
-rw-r--r-- | tools/perf/util/quote.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 95fd06cdaa99..ce4f28645e64 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -253,7 +253,7 @@ static int strcommon(const char *pathname) | |||
253 | { | 253 | { |
254 | int n = 0; | 254 | int n = 0; |
255 | 255 | ||
256 | while (pathname[n] == cwd[n] && n < cwdlen) | 256 | while (n < cwdlen && pathname[n] == cwd[n]) |
257 | ++n; | 257 | ++n; |
258 | 258 | ||
259 | return n; | 259 | return n; |
diff --git a/tools/perf/util/quote.c b/tools/perf/util/quote.c index c6e5dc0dc82f..2726fe40eb5d 100644 --- a/tools/perf/util/quote.c +++ b/tools/perf/util/quote.c | |||
@@ -318,7 +318,7 @@ char *quote_path_relative(const char *in, int len, | |||
318 | strbuf_addch(out, '"'); | 318 | strbuf_addch(out, '"'); |
319 | if (prefix) { | 319 | if (prefix) { |
320 | int off = 0; | 320 | int off = 0; |
321 | while (prefix[off] && off < len && prefix[off] == in[off]) | 321 | while (off < len && prefix[off] && prefix[off] == in[off]) |
322 | if (prefix[off] == '/') { | 322 | if (prefix[off] == '/') { |
323 | prefix += off + 1; | 323 | prefix += off + 1; |
324 | in += off + 1; | 324 | in += off + 1; |