Skip to content

Commit 705e919

Browse files
Sergey ShtylyovJessica Yu
authored andcommitted
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 the starting text into the pr_notice() call -- it saves 21 bytes of the object code (x86 gcc 10.2.1). Suggested-by: Joe Perches <joe@perches.com> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru> Signed-off-by: Jessica Yu <jeyu@kernel.org>
1 parent 5e8ed28 commit 705e919

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎kernel/module.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2907,16 +2907,17 @@ static int module_sig_check(struct load_info *info, int flags)
29072907
* enforcing, certain errors are non-fatal.
29082908
*/
29092909
case -ENODATA:
2910-
reason = "Loading of unsigned module";
2910+
reason = "unsigned module";
29112911
goto decide;
29122912
case -ENOPKG:
2913-
reason = "Loading of module with unsupported crypto";
2913+
reason = "module with unsupported crypto";
29142914
goto decide;
29152915
case -ENOKEY:
2916-
reason = "Loading of module with unavailable key";
2916+
reason = "module with unavailable key";
29172917
decide:
29182918
if (is_module_sig_enforced()) {
2919-
pr_notice("%s: %s is rejected\n", info->name, reason);
2919+
pr_notice("%s: loading of %s is rejected\n",
2920+
info->name, reason);
29202921
return -EKEYREJECTED;
29212922
}
29222923

0 commit comments

Comments
 (0)