提交 bb61c8d4 编写于 作者: S Sergey Shtylyov 提交者: Zheng Zengkai

module: merge repetitive strings in module_sig_check()

stable inclusion
from stable-5.10.26
commit 8587715b65faae25b07db16d07d09b5831f44742
bugzilla: 51363

--------------------------------

[ Upstream commit 705e9195 ]

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: NJoe Perches <joe@perches.com>
Reviewed-by: NMiroslav Benes <mbenes@suse.cz>
Signed-off-by: NSergey Shtylyov <s.shtylyov@omprussia.ru>
Signed-off-by: NJessica Yu <jeyu@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: N  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 fa17bd44
......@@ -2922,16 +2922,17 @@ static int module_sig_check(struct load_info *info, int flags)
* enforcing, certain errors are non-fatal.
*/
case -ENODATA:
reason = "Loading of unsigned module";
reason = "unsigned module";
goto decide;
case -ENOPKG:
reason = "Loading of module with unsupported crypto";
reason = "module with unsupported crypto";
goto decide;
case -ENOKEY:
reason = "Loading of module with unavailable key";
reason = "module with unavailable key";
decide:
if (is_module_sig_enforced()) {
pr_notice("%s: %s is rejected\n", info->name, reason);
pr_notice("%s: loading of %s is rejected\n",
info->name, reason);
return -EKEYREJECTED;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册