aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/kgdboc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/kgdboc.c')
-rw-r--r--drivers/serial/kgdboc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/serial/kgdboc.c b/drivers/serial/kgdboc.c
index 341830791608..9cf03327386a 100644
--- a/drivers/serial/kgdboc.c
+++ b/drivers/serial/kgdboc.c
@@ -106,7 +106,9 @@ static void kgdboc_put_char(u8 chr)
106 106
107static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp) 107static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp)
108{ 108{
109 if (strlen(kmessage) >= MAX_CONFIG_LEN) { 109 int len = strlen(kmessage);
110
111 if (len >= MAX_CONFIG_LEN) {
110 printk(KERN_ERR "kgdboc: config string too long\n"); 112 printk(KERN_ERR "kgdboc: config string too long\n");
111 return -ENOSPC; 113 return -ENOSPC;
112 } 114 }
@@ -125,6 +127,9 @@ static int param_set_kgdboc_var(const char *kmessage, struct kernel_param *kp)
125 } 127 }
126 128
127 strcpy(config, kmessage); 129 strcpy(config, kmessage);
130 /* Chop out \n char as a result of echo */
131 if (config[len - 1] == '\n')
132 config[len - 1] = '\0';
128 133
129 if (configured == 1) 134 if (configured == 1)
130 cleanup_kgdboc(); 135 cleanup_kgdboc();