Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2405910pxp; Mon, 7 Mar 2022 14:53:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvznjJKS/o7AnxAgVo+6PKF/KeZXqmIYB2En8uaRG4OUSt/zWjG4VX7a/w0kWSgUuC7qpD X-Received: by 2002:a17:906:5cb:b0:6cf:954:d84d with SMTP id t11-20020a17090605cb00b006cf0954d84dmr11404697ejt.560.1646693593022; Mon, 07 Mar 2022 14:53:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646693593; cv=none; d=google.com; s=arc-20160816; b=uEIryP+e89aw06NoUHZs93FMymlGrmajAMWQChzBT8OZIxbVLovOo8CyghDDpyvZOt 9rieDZdT+HSnOJmRdeXD+eBrYSjpHVu8UhNCA8X7pACiECnykKhxFKktrIXbmcTS4YCI EubbPNH0kpqfHqzWRfaoHtc4nRwRB3oK7CJY297B1VAsr03UXEqcmxRJvJBq6aQ07/n1 QI6Ht842+P8ToqaPWw3nzjgy4QJiw/QTgmeoQgI4iXjsSui5yo3b+boOGORo5dvFO7ds +H3TNe2YN7wY2nIXHFJ9AfxOrMTyWvPIeDij2q9k+/gHoXe4+j7+1Djka9OBkTgwAn7r 9BWA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wTqJ9ZbJUCgx8VrF++WoBF0cwmRu2Y/rNRNUF4x8BCg=; b=G3jCidacr+eIpekfzL1n720Y8nzCcXwF3dRZekCvMPmRa4fVOu0iJM0NbrL5t5Z48g Zyl4hkFoHTL+x8nhgDdkAk4O+W1uweutgVg9CnAC96qdbXRna1u0xkAd4lMxysG0AAFX ymT1s70fi9PD3ZYOGI9ticVBW3zXjANQq4tl3mQ5a7eW79mEG8qJrLoIGZozf4rc9yOG hfuZVd+uY227rcNYb6fewXLAmijaWWe07S4P2OTHATeQIc1XZFxvxCTgTzNncMwwZryE opow9MVv4tKWbht3xWZMhLx8s+apromssNRndsNSeVu4fwXaUvjYnREi5fvBTGdqx/UD yvbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jNxfdwc6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qa14-20020a170907868e00b006db06ad3a1dsi4927600ejc.572.2022.03.07.14.52.49; Mon, 07 Mar 2022 14:53:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=jNxfdwc6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244494AbiCGRq2 (ORCPT + 99 others); Mon, 7 Mar 2022 12:46:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243853AbiCGRqS (ORCPT ); Mon, 7 Mar 2022 12:46:18 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A7B2C7B569 for ; Mon, 7 Mar 2022 09:45:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646675121; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wTqJ9ZbJUCgx8VrF++WoBF0cwmRu2Y/rNRNUF4x8BCg=; b=jNxfdwc6KxoS8Qx+c+xDIyZLebC2rGm1SuuKstezhUe7rdG70i+xEydMU3LSwL8J9CFNNH xhKwiYy6IvbLBi42PspMeQYHKu0rn/xhl+JGOtVXu7n2o4tZEPqp81mHW8X7VwpDLIPiYm 6Mr2KqABgFnFPplscZ5JsBoDAln2RZ8= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-528-ZfjvM3v_No2v2vFHKNqiUw-1; Mon, 07 Mar 2022 12:45:18 -0500 X-MC-Unique: ZfjvM3v_No2v2vFHKNqiUw-1 Received: by mail-wr1-f69.google.com with SMTP id p9-20020adf9589000000b001e333885ac1so4805188wrp.10 for ; Mon, 07 Mar 2022 09:45:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wTqJ9ZbJUCgx8VrF++WoBF0cwmRu2Y/rNRNUF4x8BCg=; b=pSir7YwyGcnzZTzt6XwaLf7CAhpjD6W4QHSDnl71KoYz2RNNxmvuEv4ABpZ2kNk9os Z7R9Dui6mBtkr6/LFebdvAu393efoWQnVjsfHsb52Y+lIfi7aM4OmqldSqRbYGFL8OT5 k5cyjujZv2hr81fhmyFtkMW3stJ3gVd7k8XhF0Y4bmyuSK30GPpkmfnKSW/IflpLPk1+ IoeGvoVFlkhhOE1sroHAtxMEyc0jeHhNhQI2MmxbHGxd8Stpu//wtrA09gx3u+gE+YQu zxCOG54WEOZHEsCaiOrvxWa1YTPOKixUm3NhHR5iKCHjfj2+Ue2Wh/gKDSgbCimBbTJl a0wg== X-Gm-Message-State: AOAM530rVmaIL8u0eIge/WTfu+6YnaYM2y/PkMCfaWlEXCqJMX5yfjIu XVx+f0oh7hHx15LSHGGw9fpMxW38UJa6ADkJ7XtZ0qO0x7suq2AiMCjv3ZxJtZiBvL2khdYTJRY /3rq58kOzH9ZoFkFDpzZoPmM= X-Received: by 2002:a05:600c:1994:b0:389:bcf5:6e79 with SMTP id t20-20020a05600c199400b00389bcf56e79mr30158wmq.43.1646675117029; Mon, 07 Mar 2022 09:45:17 -0800 (PST) X-Received: by 2002:a05:600c:1994:b0:389:bcf5:6e79 with SMTP id t20-20020a05600c199400b00389bcf56e79mr30127wmq.43.1646675116770; Mon, 07 Mar 2022 09:45:16 -0800 (PST) Received: from localhost (cpc111743-lutn13-2-0-cust979.9-3.cable.virginm.net. [82.17.115.212]) by smtp.gmail.com with ESMTPSA id v25-20020a05600c215900b0038117f41728sm19970307wml.43.2022.03.07.09.45.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 09:45:15 -0800 (PST) From: Aaron Tomlin To: mcgrof@kernel.org, christophe.leroy@csgroup.eu Cc: cl@linux.com, mbenes@suse.cz, akpm@linux-foundation.org, jeyu@kernel.org, linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org, void@manifault.com, atomlin@atomlin.com, allen.lkml@gmail.com, joe@perches.com, msuchanek@suse.de, oleksandr@natalenko.name, jason.wessel@windriver.com, daniel.thompson@linaro.org, hch@infradead.org, pmladek@suse.com Subject: [PATCH v10 03/14] module: Make internal.h and decompress.c more compliant Date: Mon, 7 Mar 2022 17:44:58 +0000 Message-Id: <20220307174509.2887714-4-atomlin@redhat.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220307174509.2887714-1-atomlin@redhat.com> References: <20220307174509.2887714-1-atomlin@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch will address the following warning and style violations generated by ./scripts/checkpatch.pl in strict mode: WARNING: Use #include instead of #10: FILE: kernel/module/internal.h:10: +#include CHECK: spaces preferred around that '-' (ctx:VxV) #18: FILE: kernel/module/internal.h:18: +#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1)) CHECK: Please use a blank line after function/struct/union/enum declarations #69: FILE: kernel/module/internal.h:69: +} +static inline void module_decompress_cleanup(struct load_info *info) ^ CHECK: extern prototypes should be avoided in .h files #84: FILE: kernel/module/internal.h:84: +extern int mod_verify_sig(const void *mod, struct load_info *info); WARNING: Missing a blank line after declarations #116: FILE: kernel/module/decompress.c:116: + struct page *page = module_get_next_page(info); + if (!page) { WARNING: Missing a blank line after declarations #174: FILE: kernel/module/decompress.c:174: + struct page *page = module_get_next_page(info); + if (!page) { CHECK: Please use a blank line after function/struct/union/enum declarations #258: FILE: kernel/module/decompress.c:258: +} +static struct kobj_attribute module_compression_attr = __ATTR_RO(compression); Note: Fortunately, the multiple-include optimisation found in include/linux/module.h will prevent duplication/or inclusion more than once. Fixes: f314dfea16a ("modsign: log module name in the event of an error") Reviewed-by: Christophe Leroy Signed-off-by: Aaron Tomlin --- kernel/module/decompress.c | 3 +++ kernel/module/internal.h | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/module/decompress.c b/kernel/module/decompress.c index d14d6443225a..2fc7081dd7c1 100644 --- a/kernel/module/decompress.c +++ b/kernel/module/decompress.c @@ -113,6 +113,7 @@ static ssize_t module_gzip_decompress(struct load_info *info, do { struct page *page = module_get_next_page(info); + if (!page) { retval = -ENOMEM; goto out_inflate_end; @@ -171,6 +172,7 @@ static ssize_t module_xz_decompress(struct load_info *info, do { struct page *page = module_get_next_page(info); + if (!page) { retval = -ENOMEM; goto out; @@ -256,6 +258,7 @@ static ssize_t compression_show(struct kobject *kobj, { return sysfs_emit(buf, "%s\n", __stringify(MODULE_COMPRESSION)); } + static struct kobj_attribute module_compression_attr = __ATTR_RO(compression); static int __init module_decompress_sysfs_init(void) diff --git a/kernel/module/internal.h b/kernel/module/internal.h index ea8c4c02614c..e0775e66bcf7 100644 --- a/kernel/module/internal.h +++ b/kernel/module/internal.h @@ -6,7 +6,8 @@ */ #include -#include +#include +#include #include #ifndef ARCH_SHF_SMALL @@ -54,7 +55,7 @@ struct load_info { } index; }; -extern int mod_verify_sig(const void *mod, struct load_info *info); +int mod_verify_sig(const void *mod, struct load_info *info); #ifdef CONFIG_MODULE_DECOMPRESS int module_decompress(struct load_info *info, const void *buf, size_t size); @@ -65,6 +66,7 @@ static inline int module_decompress(struct load_info *info, { return -EOPNOTSUPP; } + static inline void module_decompress_cleanup(struct load_info *info) { } -- 2.34.1