mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omprussia.ru>
To: Jessica Yu <jeyu@kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/2] module: merge repetitive strings in module_sig_check()
Date: Tue, 13 Oct 2020 23:34:09 +0300	[thread overview]
Message-ID: <4c4a3fa0-3eee-6cca-947c-9d01e3eb2a8a@omprussia.ru> (raw)
In-Reply-To: <789a4e5c-8efd-bb1c-86e2-eed8b2b7b0af@omprussia.ru>

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@omprussia.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;
 		}
 

  reply	other threads:[~2020-10-13 20:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13 20:32 [PATCH 0/2] module: some refactoring " Sergey Shtylyov
2020-10-13 20:34 ` Sergey Shtylyov [this message]
2020-10-13 20:35 ` [PATCH 2/2] module: unindent comments " Sergey Shtylyov
2020-10-13 22:44 ` [PATCH 0/2] module: some refactoring " Joe Perches
2020-10-14  8:18   ` Sergey Shtylyov
2020-10-14  8:35     ` Joe Perches
2020-10-14 19:44       ` Sergey Shtylyov
2020-10-14 20:48         ` Joe Perches
2020-10-22 15:09 ` Jessica Yu
2020-10-22 15:29   ` Sergey Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c4a3fa0-3eee-6cca-947c-9d01e3eb2a8a@omprussia.ru \
    --to=s.shtylyov@omprussia.ru \
    --cc=jeyu@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®