Skip to contentSkip to conversation

module: print sensible error code

PATCH Applied Jason A. Donenfeld 2 participants 2 messages Jun 22, 2018 – Jun 25, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module: print sensible error code

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.

---
 kernel/module.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/module.c +2 -2
index f475f30eed8c..c666ab4139f4 100644
@@ -2282,9 +2282,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:
Signature · 1 line
2.17.1
Applied
#1 lore raw

+++ Jason A. Donenfeld [22/06/18 17:38 +0200]:

Quoted 5 lines

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.

Applied, thanks.

Jessica

Quoted 23 lines

---
kernel/module.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
kernel/module.c +2 -2
index f475f30eed8c..c666ab4139f4 100644
@@ -2282,9 +2282,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:
Signature · 1 line
2.17.1