[PATCH] module: fix invalid ELF structure error to print error code

From: Shuah Khan
Date: Wed Sep 22 2021 - 20:14:49 EST


When elf_validity_check() returns error, load_module() prints an
error message without error code. It is hard to determine why the
module ELF structure is invalid without this information. Fix the
error message to print the error code.

Signed-off-by: Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>
---
kernel/module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/module.c b/kernel/module.c
index 40ec9a030eec..a0d412d396d6 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3941,7 +3941,7 @@ static int load_module(struct load_info *info, const char __user *uargs,
*/
err = elf_validity_check(info);
if (err) {
- pr_err("Module has invalid ELF structures\n");
+ pr_err("Module has invalid ELF structures:errno(%ld)\n", err);
goto free_copy;
}

--
2.30.2