summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/sort.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-17 09:54:16 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-17 09:54:16 -0700
commit96ee0499c59810736dc2e56784d061dc6a1d98e8 (patch)
treeee558fa2917f7331ba9bed30ee49977418d6e141 /tools/perf/util/sort.c
parentcb1ecf25a84aec8c9d1fc6ad0c78adf4fd8335de (diff)
parent89c5bd08df5841326abbf167d136bcf14cf759ed (diff)
downloadlinux-96ee0499c59810736dc2e56784d061dc6a1d98e8.tar.bz2
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar. * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf tools, x86: Build perf on older user-space as well perf tools: Use scnprintf where applicable perf tools: Incorrect use of snprintf results in SEGV
Diffstat (limited to 'tools/perf/util/sort.c')
-rw-r--r--tools/perf/util/sort.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 16da30d8d765..076c9d4e1ea4 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -33,6 +33,9 @@ static int repsep_snprintf(char *bf, size_t size, const char *fmt, ...)
}
}
va_end(ap);
+
+ if (n >= (int)size)
+ return size - 1;
return n;
}