[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c4a3fa0-3eee-6cca-947c-9d01e3eb2a8a@omprussia.ru>
Date: Tue, 13 Oct 2020 23:34:09 +0300
From: Sergey Shtylyov <s.shtylyov@...russia.ru>
To: Jessica Yu <jeyu@...nel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/2] module: merge repetitive strings in module_sig_check()
The 'reason' variable in module_sig_check() points to 3 strings across
the *switch* statement, all needlessly starting with the same text. Let's
put as much of the starting text as we can into the pr_notice() call (this
includes some rewording of the 1st message) -- it saves 37 bytes of object
code (x86 gcc 10.2.1).
Signed-off-by: Sergey Shtylyov <s.shtylyov@...russia.ru>
---
kernel/module.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Index: linux/kernel/module.c
===================================================================
--- linux.orig/kernel/module.c
+++ linux/kernel/module.c
@@ -2906,16 +2906,17 @@ static int module_sig_check(struct load_
* enforcing, certain errors are non-fatal.
*/
case -ENODATA:
- reason = "Loading of unsigned module";
+ reason = "no signature";
goto decide;
case -ENOPKG:
- reason = "Loading of module with unsupported crypto";
+ reason = "unsupported crypto";
goto decide;
case -ENOKEY:
- reason = "Loading of module with unavailable key";
+ reason = "unavailable key";
decide:
if (is_module_sig_enforced()) {
- pr_notice("%s: %s is rejected\n", info->name, reason);
+ pr_notice("%s: loading of module with %s is rejected\n",
+ info->name, reason);
return -EKEYREJECTED;
}
Powered by blists - more mailing lists