Home Home > GIT Browse > SLE15-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-02-14 11:57:30 +0100
committerTakashi Iwai <tiwai@suse.de>2019-02-14 11:57:34 +0100
commit18d57dce8933314e903d0dcb98dd02db98145e7e (patch)
tree860522d661576c6bb7bc2e8d54d9ad26b6b36137
parentfd9cea37d4046f8fd6f5bd4ccf06a94be067ef26 (diff)
kgdboc: fix KASAN global-out-of-bounds bug in
param_set_kgdboc_var() (bsc#1051510). suse-commit: 81f4204151efaa1879b2b1886b56b84ef41be5d5
-rw-r--r--drivers/tty/serial/kgdboc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
index da020eea7bb5..adfbab05ba93 100644
--- a/drivers/tty/serial/kgdboc.c
+++ b/drivers/tty/serial/kgdboc.c
@@ -250,7 +250,7 @@ static void kgdboc_put_char(u8 chr)
static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp)
{
- int len = strlen(kmessage);
+ size_t len = strlen(kmessage);
if (len >= MAX_CONFIG_LEN) {
printk(KERN_ERR "kgdboc: config string too long\n");
@@ -272,7 +272,7 @@ static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp)
strcpy(config, kmessage);
/* Chop out \n char as a result of echo */
- if (config[len - 1] == '\n')
+ if (len && config[len - 1] == '\n')
config[len - 1] = '\0';
if (configured == 1)