linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] printk: drop redundant devkmsg_log_str memsets
@ 2018-01-19  4:39 Sergey Senozhatsky
  2018-01-19 14:17 ` Steven Rostedt
  2018-01-22  9:54 ` Petr Mladek
  0 siblings, 2 replies; 5+ messages in thread
From: Sergey Senozhatsky @ 2018-01-19  4:39 UTC (permalink / raw)
  To: Petr Mladek, Steven Rostedt; +Cc: linux-kernel, Sergey Senozhatsky

We copy in null terminated strings "on" and "off", no
need to zero out devkmsg_log_str in control_devkmsg().

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 kernel/printk/printk.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index d70927c384f3..9faddcfd3994 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -136,13 +136,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. */
 
 	/*
-- 
2.16.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-22  9:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-19  4:39 [PATCH] printk: drop redundant devkmsg_log_str memsets Sergey Senozhatsky
2018-01-19 14:17 ` Steven Rostedt
2018-01-20  6:05   ` Sergey Senozhatsky
2018-01-22  9:54 ` Petr Mladek
2018-01-22  9:59   ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).