X-Received: by 2002:a17:90a:b396:b0:1bc:588a:c130 with SMTP id e22-20020a17090ab39600b001bc588ac130mr4280001pjr.97.1645538792716; Tue, 22 Feb 2022 06:06:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645538792; cv=none; d=google.com; s=arc-20160816; b=USKNUjNLo6k4Xw7nsoAE2dIF2HAU9dmK6qOAXllZOrHp3PqIO8YU9lZTgF2IIOCdA4 teNNevQNWSPugf2Y4iuXHmOCKdaMShrLWYP1V5I8O6P8oI094YaTpS80bczZ0EsxHI1/ ug11hPqFN57JWdfRZeRM70QelTsvrdXDmdT73B3IdlqLvuqNDn2jN0DZPAeEHAJT/kFa bflzQePVWDBtD5UhrlDqoi9V7liHbC2gAGrcb82NBfvyeEpU5skr4OWYKM/iIsiGowAG GD5I2y321di+sNQESn+k4/GFJWJsOkDfouB9i9w3C/bPJEI3Iej6FmDMIhofPzoJYfaI ynmA== 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=b7ofljUG4lfC5M/U2sH0uNgDRJsMerqzcQfo5qXgGsaka6NsoXyedLNn5mgzwfhHxQ rhBw4j2UTwZEFppGe8pfzHQS5oBUypVTx2F6y1r3sQXb6r0rGN/WKSJbx9c95MK3iMOn q0F2l407siFZW9GCIbJ+vzxDw4cvhmobFiIwwSjOSjwX2M9qklIrXf06u5bJXuPHB//F /YjxQRDG4kH5yPnPFuIA6hzcN0EtDxJ/syq+fHEDOJyqlcy2lHz50yJQbDVeShIOkOqd lXeiSKBGx2RNC0N8QB7ppDVoBAcQyXPIlvm1n3KUwy4z3ea8kE+Xnlfk+hbXpbg+aZsx TDIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BIqXS+Cm; 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 t2si2198849pjl.126.2022.02.22.06.06.14; Tue, 22 Feb 2022 06:06:32 -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=BIqXS+Cm; 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 S232228AbiBVNJ7 (ORCPT + 99 others); Tue, 22 Feb 2022 08:09:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232176AbiBVNJq (ORCPT ); Tue, 22 Feb 2022 08:09:46 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A3E3C1520C1 for ; Tue, 22 Feb 2022 05:09:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645535358; 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=BIqXS+Cm8IvgyTptN9Bzl33kzIszez1eyghyPBSSblZqu0Wdr2NbDtEGCG3t4nLvyLkIeb 0NHFwPKft1cPXyf+h/Z22N8vadAai47qB33DY+LTN24ik5gvgIhZhvQXRuQbVHw9j4gDtJ kpx2zR6Fh5sOx58J31N9ks4Gzw4vvNQ= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-561-Rr1NaeYhMv2TzdMCEwj_mA-1; Tue, 22 Feb 2022 08:09:17 -0500 X-MC-Unique: Rr1NaeYhMv2TzdMCEwj_mA-1 Received: by mail-wm1-f71.google.com with SMTP id u14-20020a05600c210e00b0037bddd0562eso589175wml.1 for ; Tue, 22 Feb 2022 05:09:17 -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=F3t+Unvc5CcIAHnskWvjc6K3KWwAvDVfAGcAFhrnGTa2LtxAzUhiRqmdEwUQp/EQxf bwiDXVaILeem0LgdLZ4NFlPJhbWWgeODNF74hJ8s/OKvYELUThWyZLak4l02TjW494iW GwGsPvKSDbYny81IRxDOxx294tARoTMzN3XBykBhdhppdZLvi6bg8Sh8kSbdAN2kssRX xVJkuu2BTxT72qNY8RSeF2CDBw6RaVS2Q98DDV7PgSZSef4ycGtLoeWNpEqRTx8CxuqH fFtcdU6K6OtBnzMpzmd0W1HW+HyabmSUzCmyuJC8ynGEO+FWiZc4QYZ7CL8NiF+c8irt YV7Q== X-Gm-Message-State: AOAM531S/v2Ssbe8CNEjp0DJgHXL1CI2pqBU+riHX3qycvlFe695UGf8 LJEAcN23fWD+Bd6/BGFPm3Wp8tSpeGHAP726s7FghSmJX+vzS9KbX/90MUaK+/tAQVR6LMrkA/f XSE0zR8lrM8Y1cFn4U7mMFjs= X-Received: by 2002:a05:6000:18a1:b0:1ea:85c3:5f2d with SMTP id b1-20020a05600018a100b001ea85c35f2dmr2680306wri.689.1645535356643; Tue, 22 Feb 2022 05:09:16 -0800 (PST) X-Received: by 2002:a05:6000:18a1:b0:1ea:85c3:5f2d with SMTP id b1-20020a05600018a100b001ea85c35f2dmr2680289wri.689.1645535356474; Tue, 22 Feb 2022 05:09: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 l12sm50973332wrs.11.2022.02.22.05.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 05:09:16 -0800 (PST) From: Aaron Tomlin To: mcgrof@kernel.org, christophe.leroy@csgroup.eu Cc: cl@linux.com, pmladek@suse.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 Subject: [PATCH v7 03/13] module: Make internal.h and decompress.c more compliant Date: Tue, 22 Feb 2022 13:09:01 +0000 Message-Id: <20220222130911.1348513-4-atomlin@redhat.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220222130911.1348513-1-atomlin@redhat.com> References: <20220222130911.1348513-1-atomlin@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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