Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3288379pxf; Mon, 5 Apr 2021 08:10:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDBo7FuTBQG75k2EXwFShrMtK9lyi5zHlCASUzzYrYswiUXQt6Oyq04W0BSMwG30Gy+EQX X-Received: by 2002:a05:6402:4a:: with SMTP id f10mr31737314edu.85.1617635439802; Mon, 05 Apr 2021 08:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617635439; cv=none; d=google.com; s=arc-20160816; b=t9TtCIUz5W2Vhr8tkuv5Wz2p8SGtE1oaDKSloHjv0gW9dZOndhl01S9GZc/zbEkQpI 0s9TawbI6lCZlVWVb4X0VIvQWJVsEL7wWDDB63rPmk/mc9N99X4/HX40ZQuYbPGGkD7K ht8w7ccOR4tQVLT1M04QPEmBjIk1Z0Fv8uIc2HJv/FG0WVSMa8q3JPNhecD17Duhr8qD eVCzBdnPqy5FgLYAFb9g3YwB73oLBT+T4E1kjxOImpGey1sdizkfRB0LRy6NrNsvzW9S ysEj1HoW/WoKiIO/UvQ+lpEj6aQJNtewbc+dB40Zc/y7Pml3AlR6o4dbzdIEPfrCKGwG w9+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+Idk20dRXSc0jLAQQ5xRxfuJNQEryK54kWBCdx2IlXs=; b=KHYRAvzoU5rU5GuhblPOLLduLFCo8zFuEVJ9QOwD55Hi6g8HzSmjDdvolIg1hDlJ2I X7Zhf079tu6DMEmf8/TI4g22mChHCAg2CfL/p7zDiFQJcZQ5ANRnsttuFDq2zPtz7z5w afGExdErHYHRAHkd6wN9ExZR/gfQnxQMLfO9ngKPbcuRW7SfsCzyGQtMlPJ4Z+YX6MFT 9mEKE5PhAqZpTL4J1MSJI1BcoizpOohw8f1Z2fLguFUiNhOcVCkSsRmVpyuoAzU2KNRt S/zJZlkVQJ3/bJfL4nplnvGj6YxdF6Cyvzf28ji+1VJ9BP0smSvCR030saw+RqIX2+Z6 WNDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IUiskFRn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y23si13279938ejp.249.2021.04.05.08.09.47; Mon, 05 Apr 2021 08:10:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IUiskFRn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237935AbhDEJEP (ORCPT + 99 others); Mon, 5 Apr 2021 05:04:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:45396 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237546AbhDEJCy (ORCPT ); Mon, 5 Apr 2021 05:02:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 310576138A; Mon, 5 Apr 2021 09:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617613368; bh=vFNmNt+U/hd/gxxm8RYCo69Q9+MJfjIf8BhgTyZ+l84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IUiskFRngR2lhSwY0kpP7ZnW83fy0d66YzWFzu3teBuicjaKpQVhLnUthz3MgW7L1 H5ERBiNQr7m/Pbca1+SN7wLsfP3Klfjs90y1rUn78WJ5GLnL7ufFsH1SkOAtfzEKUE N+76MPyGQ6MlGnAfUd9MmCi58vaMYDTjo4JXiZaA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Perches , Miroslav Benes , Sergey Shtylyov , Jessica Yu , Sasha Levin Subject: [PATCH 5.4 03/74] module: merge repetitive strings in module_sig_check() Date: Mon, 5 Apr 2021 10:53:27 +0200 Message-Id: <20210405085024.812932452@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210405085024.703004126@linuxfoundation.org> References: <20210405085024.703004126@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergey Shtylyov [ Upstream commit 705e9195187d85249fbb0eaa844b1604a98fbc9a ] 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 Reviewed-by: Miroslav Benes Signed-off-by: Sergey Shtylyov Signed-off-by: Jessica Yu Signed-off-by: Sasha Levin --- kernel/module.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/kernel/module.c b/kernel/module.c index ab1f97cfe18d..9fe3e9b85348 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -2908,16 +2908,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 is rejected\n", reason); + pr_notice("%s: loading of %s is rejected\n", + info->name, reason); return -EKEYREJECTED; } -- 2.30.1