[PATCH 2/2] printk: Use %pCOW for kmsg

From: Richard Weinberger
Date: Sun Apr 01 2018 - 04:57:04 EST


...userspace likes eye candy.

Signed-off-by: Richard Weinberger <richard@xxxxxx>
---
kernel/printk/printk.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index f274fbef821d..42ea0a18081d 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -815,7 +815,10 @@ static ssize_t devkmsg_write(struct kiocb *iocb, struct iov_iter *from)
}
}

- printk_emit(facility, level, NULL, 0, "%s", line);
+ if (line[len - 1] == '\n')
+ line[len - 1] = '\0';
+
+ printk_emit(facility, level, NULL, 0, "%pCOW", line);
kfree(buf);
return ret;
}
--
2.13.6