aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/batman-adv/main.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 65b4f0824e4f..8610b5caa178 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -381,14 +381,19 @@ int bat_algo_seq_print_text(struct seq_file *seq, void *offset)
381static int param_set_ra(const char *val, const struct kernel_param *kp) 381static int param_set_ra(const char *val, const struct kernel_param *kp)
382{ 382{
383 struct bat_algo_ops *bat_algo_ops; 383 struct bat_algo_ops *bat_algo_ops;
384 char *algo_name = (char *)val;
385 size_t name_len = strlen(algo_name);
384 386
385 bat_algo_ops = bat_algo_get((char *)val); 387 if (algo_name[name_len - 1] == '\n')
388 algo_name[name_len - 1] = '\0';
389
390 bat_algo_ops = bat_algo_get(algo_name);
386 if (!bat_algo_ops) { 391 if (!bat_algo_ops) {
387 pr_err("Routing algorithm '%s' is not supported\n", val); 392 pr_err("Routing algorithm '%s' is not supported\n", algo_name);
388 return -EINVAL; 393 return -EINVAL;
389 } 394 }
390 395
391 return param_set_copystring(val, kp); 396 return param_set_copystring(algo_name, kp);
392} 397}
393 398
394static const struct kernel_param_ops param_ops_ra = { 399static const struct kernel_param_ops param_ops_ra = {