summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorChen Gang <gang.chen@asianux.com>2013-11-05 16:57:36 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2013-11-05 16:57:36 +1100
commitb0b927330fa033c241e1065b732dfed891ef568a (patch)
tree2c6fe1016ee33045dd2d6bf97c340ea186062c23 /kernel
parent40313cf64fc39f3a209f6889a08cc4cda2032e5d (diff)
kernel/kexec.c: use vscnprintf() instead of vsnprintf() in vmcoreinfo_append_str()
vsnprintf() may let 'r' larger than sizeof(buf), in this case, if 'r' is also less than "vmcoreinfo_max_size - vmcoreinfo_size" (left size of destination buffer), next memcpy() will read the unexpected addresses. Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/kexec.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 2a74f307c5ec..0abcd688fe2c 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -1533,7 +1533,7 @@ void vmcoreinfo_append_str(const char *fmt, ...)
size_t r;
va_start(args, fmt);
- r = vsnprintf(buf, sizeof(buf), fmt, args);
+ r = vscnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
r = min(r, vmcoreinfo_max_size - vmcoreinfo_size);