summaryrefslogtreecommitdiffstats
path: root/kernel/printk/nmi.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/printk/nmi.c')
-rw-r--r--kernel/printk/nmi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/printk/nmi.c b/kernel/printk/nmi.c
index 16bab47..152533e 100644
--- a/kernel/printk/nmi.c
+++ b/kernel/printk/nmi.c
@@ -67,7 +67,8 @@ static int vprintk_nmi(const char *fmt, va_list args)
again:
len = atomic_read(&s->len);
- if (len >= sizeof(s->buffer)) {
+ /* The trailing '\0' is not counted into len. */
+ if (len >= sizeof(s->buffer) - 1) {
atomic_inc(&nmi_message_lost);
return 0;
}
@@ -79,7 +80,7 @@ again:
if (!len)
smp_rmb();
- add = vsnprintf(s->buffer + len, sizeof(s->buffer) - len, fmt, args);
+ add = vscnprintf(s->buffer + len, sizeof(s->buffer) - len, fmt, args);
/*
* Do it once again if the buffer has been flushed in the meantime.
OpenPOWER on IntegriCloud