module: print sensible error code
authorJason A. Donenfeld <Jason@zx2c4.com>
Fri, 22 Jun 2018 15:38:50 +0000 (17:38 +0200)
committerJessica Yu <jeyu@kernel.org>
Mon, 25 Jun 2018 08:37:08 +0000 (10:37 +0200)
Printing "err 0" to the user in the warning message is not particularly
useful, especially when this gets transformed into a -ENOENT for the
remainder of the call chain.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
kernel/module.c

index 0ad0bb5..b6b3a3c 100644 (file)
@@ -2284,9 +2284,9 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
                        if (!ksym && ELF_ST_BIND(sym[i].st_info) == STB_WEAK)
                                break;
 
-                       pr_warn("%s: Unknown symbol %s (err %li)\n",
-                               mod->name, name, PTR_ERR(ksym));
                        ret = PTR_ERR(ksym) ?: -ENOENT;
+                       pr_warn("%s: Unknown symbol %s (err %d)\n",
+                               mod->name, name, ret);
                        break;
 
                default: