diff options
author | Petr Mladek <pmladek@suse.com> | 2019-09-16 12:54:25 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.com> | 2019-09-16 12:54:25 +0200 |
commit | ae88de56a1893bdccc7b5af8c12556de649d675e (patch) | |
tree | e3b70d7df5d379c20ac15d9fea3a7642e1f2f3e1 /kernel/printk/printk.c | |
parent | c9dccacfccc72c32692eedff4a27a4b0833a2afd (diff) | |
parent | 085a3a8fdf3e2fbd4678dbeccbb656bd328b3715 (diff) | |
download | linux-stable-ae88de56a1893bdccc7b5af8c12556de649d675e.tar.gz linux-stable-ae88de56a1893bdccc7b5af8c12556de649d675e.tar.bz2 linux-stable-ae88de56a1893bdccc7b5af8c12556de649d675e.zip |
Merge branch 'for-5.4' into for-linus
Diffstat (limited to 'kernel/printk/printk.c')
-rw-r--r-- | kernel/printk/printk.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 424abf802f02..ca65327a6de8 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -118,19 +118,29 @@ static unsigned int __read_mostly devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT; static int __control_devkmsg(char *str) { + size_t len; + if (!str) return -EINVAL; - if (!strncmp(str, "on", 2)) { + len = str_has_prefix(str, "on"); + if (len) { devkmsg_log = DEVKMSG_LOG_MASK_ON; - return 2; - } else if (!strncmp(str, "off", 3)) { + return len; + } + + len = str_has_prefix(str, "off"); + if (len) { devkmsg_log = DEVKMSG_LOG_MASK_OFF; - return 3; - } else if (!strncmp(str, "ratelimit", 9)) { + return len; + } + + len = str_has_prefix(str, "ratelimit"); + if (len) { devkmsg_log = DEVKMSG_LOG_MASK_DEFAULT; - return 9; + return len; } + return -EINVAL; } |