Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3264300pxm; Mon, 28 Feb 2022 15:58:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxOukTqPx133H9AC3pCnXYIvUTy08WUl1pHep3xqi1R4dfuJhHBQUpDD7COaqvCMw86XNj X-Received: by 2002:a17:906:5907:b0:6ce:e652:84de with SMTP id h7-20020a170906590700b006cee65284demr576214ejq.47.1646092716930; Mon, 28 Feb 2022 15:58:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646092716; cv=none; d=google.com; s=arc-20160816; b=Ni8nimeioyY5nlScFdEprg5nEdPmNUwARCVTVlmdvmcT2D6FW7vc0V3KnJ2fc4839H CiqiFfsHmph5q4/uw/nPnOE9gc02RGE3W//1Txb6FMMU5957Rje56YPiqzLktnXXEhAu FI/gWhggkTP5OPg6XPavbt7mbR697YyfjhljquUV02sGOMfgWHubRoXcA8FPRgk9IEiW 6+qusprBR6R8tLmu3IrG3m/iEt/LA79rfKJMttYosSoeCTvdRlnnbc4I+7eAfpb2OS5Q wNpbPm4vn4RWUDOlTge34padUyLhUr8+PmhJZEJv5AeNMUmwupATGQ+zPUiUi7kkIFZd +xpQ== 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=orwrIn92Vks1fwIPHoiH25U32JWQN9dV5hlqQsJv3H+yuxmajAWCLebkh+ORBwcgwf /lqsdvpPk55Nr3vERJsExtwMFrZ72hA6DpMDWBnYZG5bZkv31uaV+oN63HDs5HNOHfkz PIg/wKip1+MBUSkuuStVlxdSTlzdhkNMep3R3fM1lCtUULADHUJcAG3N8Cg/ti7lN34O OEAdW2R+LV/oClnzEWeVGTpbd3F2hUJLLdvrJbTrM75RFB0zXkFnTYt2LcYmovuPpMfs AsW2CYwo8AH4YlyESAM3stYBPYbYwxAp4hgKDfK4ZVLy/5FFyGNlRbjnjnNWqqt5EYZm ThxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AI37lD+q; 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 v8-20020a170906180800b006ce06d94796si6512522eje.389.2022.02.28.15.58.13; Mon, 28 Feb 2022 15:58:36 -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=AI37lD+q; 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 S231547AbiB1XoY (ORCPT + 99 others); Mon, 28 Feb 2022 18:44:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231358AbiB1XoP (ORCPT ); Mon, 28 Feb 2022 18:44:15 -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 B0DECECB1A for ; Mon, 28 Feb 2022 15:43:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1646091813; 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=AI37lD+qhzI8vryQpEI6QaBSFV9l/SDE0baZlbvLLotKI55ZIUKVrSwEDCZFNuFoJttogW ffslVZkA4Syut7DCLrXprB4n6CnlPqc5QPXu7uyYKtU4F/WYtsQzwxPVctdJk8S2MxIpT6 5MZUj7UtlBJt8KCrMT1Itu1bnYfG9ow= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-117-YTPXQVpxPIieOmdDYnNnAA-1; Mon, 28 Feb 2022 18:43:32 -0500 X-MC-Unique: YTPXQVpxPIieOmdDYnNnAA-1 Received: by mail-wr1-f72.google.com with SMTP id v17-20020adfa1d1000000b001ed9d151569so2562498wrv.21 for ; Mon, 28 Feb 2022 15:43:32 -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=uZlXzzU2XO260oIsZAd7ye4pO1VahRD39y2dDqHNzurzZV/ruZ2dLG8JGM6Ew+jIe4 ZXnj1olsQkrLWmc8ejllXJvTpO+KSREEg2SjA1tyjaKtXaQalzjbVk33RFS89yr1b1w0 4fy0vTKsl2Oo5VobI67H7xb/Z6aSbr2cCuDdSjxMfZ2AD3jJ45BPQl/Xvi4atyLNhTe+ 3PoPEUbV8G2/Ev3c3ejvCOXJrlO7dcZVXpzGmEHcsxU9ub/JdO6/ojTQqP0+uQP3ZTX1 Fg24V0mrzbFJQiu1TkYpBk3n8tOHMBlhWHW9qLZKN+7yyyXydYT8+7miRi3AV0D2cC+m bk6A== X-Gm-Message-State: AOAM5335bmQopRJSLngzpqO0mMnlqi79X4qjJqi5DYbxfzAMG4KJJ9Qo ppQuPSD/NDuEFw/FCx5aacFS94SEndEtAtZ2WFTUckuwcBPzGN1zpMoBALjC9EM8/pynMyXVLup qZIIWfl3F2sojrZ2PQTqG2CA= X-Received: by 2002:a05:6000:15c3:b0:1ea:7db3:8bbe with SMTP id y3-20020a05600015c300b001ea7db38bbemr17241941wry.631.1646091811213; Mon, 28 Feb 2022 15:43:31 -0800 (PST) X-Received: by 2002:a05:6000:15c3:b0:1ea:7db3:8bbe with SMTP id y3-20020a05600015c300b001ea7db38bbemr17241922wry.631.1646091811038; Mon, 28 Feb 2022 15:43:31 -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 v5-20020a05600c15c500b003810188b6basm708063wmf.28.2022.02.28.15.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 15:43:29 -0800 (PST) From: Aaron Tomlin To: mcgrof@kernel.org, christophe.leroy@csgroup.eu, pmladek@suse.com 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 Subject: [PATCH v9 03/14] module: Make internal.h and decompress.c more compliant Date: Mon, 28 Feb 2022 23:43:11 +0000 Message-Id: <20220228234322.2073104-4-atomlin@redhat.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220228234322.2073104-1-atomlin@redhat.com> References: <20220228234322.2073104-1-atomlin@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.2 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=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