Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3694913pxf; Mon, 5 Apr 2021 20:22:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9QvyLYcu9WrwFhDepgmjd1Y6PSxCGloMId2EoqAKbbToODzP5dOYBX2TnwIvYDcRGAvTK X-Received: by 2002:a17:906:8470:: with SMTP id hx16mr19014948ejc.153.1617679368123; Mon, 05 Apr 2021 20:22:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617679368; cv=none; d=google.com; s=arc-20160816; b=YJ2X0/jVSHSb7elnecl6PDGPE+22+Aw9Zq+pbHXF+m3wSSfdBV/sb06JuZkr686cnD Qmwo2r14Yi05bIEG7E6QjC1gqYQUaZyC5XRao2RMHbQClStTmVianY63vvyhLOl242Hv bqaewdXdVUpZ1NAGxANbrkH62abNbW81PjB/oMCeHA+SB8/YJuKZUOYz66EjAP3IN1M1 IuFTShpcC+/fUo5SbkqTBPJW52Kygw35CIgAe9hlqexsEyzjTBA/GnUZKiNvSrmdAbue 3XlBG1368qIBtbi3qVkA/+oQ+L0Ptc+eMS+1L76wasQ/hee88UUYLgh3D8YmP5LRy7ja g49A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=I119EDvOVqBgmCMAi2Q1wOHKv6aonIw8M7W8joJ+ilk=; b=eXxq++6uA2IgYKhaypM2PSCSr8W0XnjRGMspNnjnRX3sz6WX3JEok88OiykL0K5dxX 0kOV01VOU2eFt3nEV3l37uCsdv5le444rDTaYQn9nk2CMvt/ssOybMsaHfyzAKNpJYoK laTFtBcF387FY0/510p6BhPURjVCLWwLAkchTrLTtgB1/pD6SFKtAivw7spCe+WUeBcK VUzvltps0eKUJ78dsGrVJhwlAruIWNBiqqT6nO6JuiXEXJ3PHbkTihO6NohajwayGJOF MGpd4MB6dnT5IBjNxmP7gUTgse5/lI9T0RwQlChZJFwlcjTy1/nkaz+AfEEK8Y+2PcuU DmBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AgllefME; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jp21si1194418ejb.662.2021.04.05.20.22.25; Mon, 05 Apr 2021 20:22:48 -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=@kernel.org header.s=k20201202 header.b=AgllefME; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242626AbhDEQOv (ORCPT + 99 others); Mon, 5 Apr 2021 12:14:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:34314 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242366AbhDEQOJ (ORCPT ); Mon, 5 Apr 2021 12:14:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3EFFE61025; Mon, 5 Apr 2021 16:14:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617639243; bh=+71CR4VPWaNxi6TkmQ3DsUkmoBmkMqvKWMBfCKtK+9E=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AgllefME47CDaOfwozWGvxuUfjANDCamRS+6/f71FlvvKxMKT7T7oEmUqMB1MQi6F VHTbduM2v1yYV3M/6BnczpuQmidyS2o4NeoQorDbZ8ASoiA1SBguZiB1XoZTLi2fz/ pgW3AZwGTJUd2WmZ6yq50oE907eZixK9QibKhI1D67iWFAcnRDubxDvn4kCE3s3Yeb 1pBSXZgh2CsAPCZxlIIBJZbR3PCQbTZ8QHwskhpjGXehLmkM52Jfti27hnGBkI2xk9 R/xSf0h3XkDh0YCY0WEJB+Dyqpyr0g5KJig3eUW/L+kGtbCdJupArRNVDySRCcwhiD ftU84jHl3l0lg== Date: Mon, 5 Apr 2021 12:14:02 -0400 From: Sasha Levin To: Sergey Shtylyov Cc: Greg Kroah-Hartman , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Joe Perches , Miroslav Benes , Jessica Yu Subject: Re: [PATCH 5.4 03/74] module: merge repetitive strings in module_sig_check() Message-ID: References: <20210405085024.703004126@linuxfoundation.org> <20210405085024.812932452@linuxfoundation.org> <35560933-d158-76ee-0034-0b5f43d9a3c2@omprussia.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 05, 2021 at 05:11:13PM +0300, Sergey Shtylyov wrote: >On 4/5/21 4:40 PM, Greg Kroah-Hartman wrote: > >[...] >>>> [ 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); >>> >>> Mhm, in 5.4 there was no printing of 'info->name'... >> >> Is that now a problem? > > Looking at 5.4.y, it probably shouldn't be a problem... but I had to go and look. :-) > I've found a simple commit that added 'info->name' printing (perhaps should also be >considered for inclusion?): > >https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e9f35f634e099894f4d6c3b039cd3de5281ee637 Ah yes, looks like I squashed it in by mistake. I'll fix it up in the queue. Thanks! -- Thanks, Sasha