lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 17 May 2013 12:33:27 +0800
From:	Chen Gang <gang.chen@...anux.com>
To:	Rusty Russell <rusty@...tcorp.com.au>
CC:	Linus Torvalds <torvalds@...ux-foundation.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH v3] kernel/module.c: need return the first error code to upper
 caller when error occurs


When multiple errors occur, simplify_symbols() will return the last
error code to the upper caller.

In this case, better to return the first error code to the upper caller.

Just like "using compiler": it will print all errors and warnings as
much as it can, but the user usually mainly focus on the first error or
warning. Since 'user' only can get one error return code, 'he/she'
usually assume the error code will match the first error print line.


Signed-off-by: Chen Gang <gang.chen@...anux.com>
---
 kernel/module.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index e4ee1bf..9e6c96d 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1976,7 +1976,8 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
 			pr_debug("Common symbol: %s\n", name);
 			printk("%s: please compile with -fno-common\n",
 			       mod->name);
-			ret = -ENOEXEC;
+			if (!ret)
+				ret = -ENOEXEC;
 			break;
 
 		case SHN_ABS:
@@ -1999,7 +2000,8 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
 
 			printk(KERN_WARNING "%s: Unknown symbol %s (err %li)\n",
 			       mod->name, name, PTR_ERR(ksym));
-			ret = PTR_ERR(ksym) ?: -ENOENT;
+			if (!ret)
+				ret = PTR_ERR(ksym) ?: -ENOENT;
 			break;
 
 		default:
-- 
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ