summaryrefslogtreecommitdiffstats
path: root/kernel/printk
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky.work@gmail.com>2018-01-19 13:39:01 +0900
committerPetr Mladek <pmladek@suse.com>2018-01-22 10:33:04 +0100
commit6fd78a1a99c9580da49ee8f951fdce9846256375 (patch)
tree72805c356b7735b3084d7a50161725339bbc5c4d /kernel/printk
parentcca10d58d25d271f05e1115132b4c2d913bb652e (diff)
downloadlinux-6fd78a1a99c9580da49ee8f951fdce9846256375.tar.gz
linux-6fd78a1a99c9580da49ee8f951fdce9846256375.tar.bz2
linux-6fd78a1a99c9580da49ee8f951fdce9846256375.zip
printk: drop redundant devkmsg_log_str memsets
We copy in null terminated strings "on" and "off", no need to zero out devkmsg_log_str in control_devkmsg(). Link: http://lkml.kernel.org/r/20180119043901.1728-1-sergey.senozhatsky@gmail.com Cc: linux-kernel@vger.kernel.org Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Petr Mladek <pmladek@suse.com>
Diffstat (limited to 'kernel/printk')
-rw-r--r--kernel/printk/printk.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 568729e0dc2c..bf2e6741ec12 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -131,13 +131,10 @@ static int __init control_devkmsg(char *str)
/*
* Set sysctl string accordingly:
*/
- if (devkmsg_log == DEVKMSG_LOG_MASK_ON) {
- memset(devkmsg_log_str, 0, DEVKMSG_STR_MAX_SIZE);
- strncpy(devkmsg_log_str, "on", 2);
- } else if (devkmsg_log == DEVKMSG_LOG_MASK_OFF) {
- memset(devkmsg_log_str, 0, DEVKMSG_STR_MAX_SIZE);
- strncpy(devkmsg_log_str, "off", 3);
- }
+ if (devkmsg_log == DEVKMSG_LOG_MASK_ON)
+ strcpy(devkmsg_log_str, "on");
+ else if (devkmsg_log == DEVKMSG_LOG_MASK_OFF)
+ strcpy(devkmsg_log_str, "off");
/* else "ratelimit" which is set by default. */
/*