]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
batman-adv: ignore trailing CR when comparing protocol names
authorMarek Lindner <lindner_marek@yahoo.de>
Wed, 18 Apr 2012 09:16:39 +0000 (17:16 +0800)
committerAntonio Quartulli <ordex@autistici.org>
Mon, 18 Jun 2012 16:00:59 +0000 (18:00 +0200)
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
net/batman-adv/main.c

index 65b4f0824e4f4ca83b53fd9be4c58246c5039366..8610b5caa17801d76a23c4cadc981e617c66bd7c 100644 (file)
@@ -381,14 +381,19 @@ int bat_algo_seq_print_text(struct seq_file *seq, void *offset)
 static int param_set_ra(const char *val, const struct kernel_param *kp)
 {
        struct bat_algo_ops *bat_algo_ops;
+       char *algo_name = (char *)val;
+       size_t name_len = strlen(algo_name);
 
-       bat_algo_ops = bat_algo_get((char *)val);
+       if (algo_name[name_len - 1] == '\n')
+               algo_name[name_len - 1] = '\0';
+
+       bat_algo_ops = bat_algo_get(algo_name);
        if (!bat_algo_ops) {
-               pr_err("Routing algorithm '%s' is not supported\n", val);
+               pr_err("Routing algorithm '%s' is not supported\n", algo_name);
                return -EINVAL;
        }
 
-       return param_set_copystring(val, kp);
+       return param_set_copystring(algo_name, kp);
 }
 
 static const struct kernel_param_ops param_ops_ra = {