Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5056466pxu; Tue, 13 Oct 2020 13:45:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHFM9Y9UIoBSq3x7j7x/CzsRv9qDkmJsBCURsJVYkAjoo5g/N+UnfYtaAXURdaZ61FdLe9 X-Received: by 2002:a17:906:30c5:: with SMTP id b5mr1717280ejb.460.1602621908897; Tue, 13 Oct 2020 13:45:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602621908; cv=none; d=google.com; s=arc-20160816; b=jdrRTAigI9N57KFkyhY9MlabLrHDx0wqXz8qBi6yY3XKMZf8FWLCh7RMDjPjNAB+Mv gPxRsQcKXiIVw1Osvt1ICUg5dh/N9om43IXyL6K1LPOCT53TXe1DNyxIEUwgDFHoWFRQ Fd7Xsa+41fNPbAQEQcrC3rimRU4wacet74tFpRqw12KjfiIqwRVuexipM+FzHNO0oojg AUJtYI4a8/GLkFthHYWgXL3ifQnfWyDmc9Tx/RZimHLcLpBzuGS7E4EQEWXV4qrQ5vys rerHqOZJgeSDs++Ci6qtt0nmVz9VddcOrJETEIcD3uc+GiR7LnJ/Udk1U6Eso+CGmFkQ EL4Q== 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:to:from:subject:dkim-filter; bh=qLdQd4mCyL1lum1gHBjL7BUYMMWJRJm+afXGUn9rGcI=; b=RSvXsmSWShSspc4oKou5BTY+PRd4FeoDO/6MGaG9bpV42D+G8VwH2VW2o+q/di/Clc i/iyKSbjNa+U+G6P3/OUU597MVv2Tvn3HugF7TKMXmO1V3wHRDf/hxHHOH43scZWnUpT o9tuuf6tLiuFEz+x6hbSzy1sXz9HFSgk7eXQv2UFDNchHmfax3a1nPSzlcQR4esU1FSk nYHCjlTT5xLaHRDsdoyyuYAVDYeU/baXROmiJ05yU05XqptXK8rdmXXHT7y8Y0YdaCFZ 6hY3hV4EYjMfJ+KM9UaD8O2thhsRbmJuE3UHsvZLXl/LB4a7TR9B7B/YZ0TlzoxC7A5V RzaA== 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 u24si647457ejj.66.2020.10.13.13.44.45; Tue, 13 Oct 2020 13:45:08 -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 S1727498AbgJMUnN (ORCPT + 99 others); Tue, 13 Oct 2020 16:43:13 -0400 Received: from mxout04.lancloud.ru ([89.108.124.63]:47504 "EHLO mxout04.lancloud.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727215AbgJMUnM (ORCPT ); Tue, 13 Oct 2020 16:43:12 -0400 Received: from LanCloud DKIM-Filter: OpenDKIM Filter v2.11.0 mxout04.lancloud.ru ADCE320275ED Received: from LanCloud Received: from LanCloud Received: from LanCloud Subject: [PATCH 1/2] module: merge repetitive strings in module_sig_check() From: Sergey Shtylyov To: Jessica Yu , References: <789a4e5c-8efd-bb1c-86e2-eed8b2b7b0af@omprussia.ru> Organization: Open Mobile Platform, LLC Message-ID: <4c4a3fa0-3eee-6cca-947c-9d01e3eb2a8a@omprussia.ru> Date: Tue, 13 Oct 2020 23:34:09 +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: <789a4e5c-8efd-bb1c-86e2-eed8b2b7b0af@omprussia.ru> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [213.87.131.195] 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 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 --- 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; }