Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp2246142pxx; Sat, 31 Oct 2020 13:11:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw+tep4oOYnU7ad6ob8/O5krRV3yjGzjEk9BP97WW5DgyCPl6IdrI87FF8bennLKq+Ad7Sn X-Received: by 2002:aa7:d1d5:: with SMTP id g21mr8751798edp.388.1604175073364; Sat, 31 Oct 2020 13:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604175073; cv=none; d=google.com; s=arc-20160816; b=Gd+RuglqheY5uMRpWfKho1ue66e3fLks4NPIGBNTyafQfhbz5IuH+IT8l797F1em8p fGyRzpdusmL4hKHHhIPfjanOH1LPOoB57sCBNnmYGi/2iBHmXAjTu8/iq9TJ65cT7Wry NdzeXYttOLSOqsaK4tbDnhYvEHoYLMA2B2/R3dr+K01f7mYDa7rTr6DeqIy7yrElgnoh +Rs/KKPqTAtHrSePrt5QGG/aV5FEzVIAfuBpqFSCUla4pZaO/+eZ1cpmMGEm3WyMtgVx dQoxpxEcdU0NLNMwCqsRTL1PmB14kD4qcbZnp01L2P9yMNeZ7pZzF5SNtFn/1VAZukzh 90qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :references:cc:to:from:subject:dkim-filter; bh=q5CEKnk+voLU2daPjV05DepDTM/ONPMN/E889wydrhA=; b=fJ24zinglnaG4MDJRXLBD8ZPD8aUuJ1vxGJtlQm8UsRvXUdHJLZMJu0rfNx7N1vW5J FHNBMu2+MhI4bKJATMzjWTQYUBvGbuS/wd2veRFcGPXHSR5RSmasIS4+F2lu4IE0tRBc fvc9DOfqST6fhLurOfu/3mSlz5nzIsaTEe+XL8NdSSW80mTcybUjVYacXqt0P+NzfSiX QSk1PYWtmHj4ff+Q8AzOb0xTYGrJsEwcYJVpMyJ2b3QlzemWdkQx54XdZOzC0koQENNH wb09w6FYre9nU+hWNK70Edx1tQ2G/qQN3eYMnuwo8MUodXz6l+Kk19pPwAM7F417cOez DouA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=omprussia.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de24si7049336edb.386.2020.10.31.13.10.50; Sat, 31 Oct 2020 13:11:13 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=omprussia.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728583AbgJaUGs (ORCPT + 99 others); Sat, 31 Oct 2020 16:06:48 -0400 Received: from mxout04.lancloud.ru ([89.108.124.63]:46030 "EHLO mxout04.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728533AbgJaUGs (ORCPT ); Sat, 31 Oct 2020 16:06:48 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru 29108204FB80 Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: [PATCH v2 1/3] module: merge repetitive strings in module_sig_check() From: Sergey Shtylyov To: Jessica Yu , CC: Joe Perches References: <22e48a3d-06ee-5b8e-6e56-3694871a7c2f@omprussia.ru> Organization: Open Mobile Platform, LLC Message-ID: Date: Sat, 31 Oct 2020 23:06:45 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.1 MIME-Version: 1.0 In-Reply-To: <22e48a3d-06ee-5b8e-6e56-3694871a7c2f@omprussia.ru> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [213.87.129.247] X-ClientProxiedBy: LFEXT01.lancloud.ru (fd00:f066::141) To LFEX1908.lancloud.ru (fd00:f066::208) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Sergey Shtylyov --- Changes in version 2: - put less starting text into the pr_notice() call; - updated the patch description accordingly, added the "Suggested-by:" tag. 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 @@ -2907,16 +2907,17 @@ static int module_sig_check(struct load_ * 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; }