Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6976837rwb; Tue, 22 Nov 2022 23:46:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf7J1UhzbWhL1McRn7rYSRknFurHlSUPkcNYIAZITzWXnL4wb3pyqTgHPsz+IS9CUyVjwK7p X-Received: by 2002:a05:6a00:410b:b0:56d:91d1:a903 with SMTP id bu11-20020a056a00410b00b0056d91d1a903mr7920750pfb.61.1669189591079; Tue, 22 Nov 2022 23:46:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669189591; cv=none; d=google.com; s=arc-20160816; b=oHF/n1ix/YBn3z9kQSMA9mKs9DkoxUkJXz4rtliXco1a9j1+MMVPcxAqAC6UzvD1lG mBmUSQ6+zC0tc9h52M5jlpbMa2bDUO3LFBMGnTQdFEr5IDS6ekTieemrCoCO6ryW+Adr KXYfwJSrDs4sm2+eansnoOBXSW2TaOY4JqxPFPhJ/TdtXLHiwdCde8SUFBnKwiDp1ka4 ud3ozpEJ5urXFrZNVJj1fKP6MS3GV+/XlsgYYI9kk4NXnU4j6kr+Cl0sSSBAQ2/UwxYP 2NfPMR5vU8rJG1RV/1/d7UUtYw9OEWLzEjXK6sczUi8CqXDNBMOIQgBX7lkrxckacIaF 6mLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=iyE0xSG9QXx26jTpu1lfkNPJFFUODiYFhdSLPEHRmYs=; b=gEEbiq01Y4B4BumcgslDhA225qrw2DaxbtlvkazXgf4cEuYsukVLZNjFH7Qk1uzPob TgNRCdIGxL7BJd5MYYG4m5HvszAHhdO+UOHxFDg0pwtFpPehjx0o92VfgqAU8iT8IRLR GR9vCNXEbTGEs9MSNWxtvoIayUL8gl/f0Y9az7rSLjLGMFfQyuYMLrAXsmvJbbPDH4FN hT3kKCTofXmf0fE/zRIfKK7eL93Ud6z0BQHjPIqDMJDhIAxlkqas/+Zbnn74qcvOSbiO ws9I2fdGwmt10yFMMjSaYzj92K/MFivIIWKyixQUmEBSPcSfCYn75nZI+YU7PeuZ8GoL djog== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id il13-20020a17090b164d00b001fd70129092si1294178pjb.15.2022.11.22.23.46.19; Tue, 22 Nov 2022 23:46:31 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236002AbiKWH2Q (ORCPT + 89 others); Wed, 23 Nov 2022 02:28:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235343AbiKWH2P (ORCPT ); Wed, 23 Nov 2022 02:28:15 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4D9D40926 for ; Tue, 22 Nov 2022 23:28:13 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxkAv-0000f7-Fn; Wed, 23 Nov 2022 08:28:05 +0100 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1oxkAs-00011W-Lt; Wed, 23 Nov 2022 08:28:02 +0100 Date: Wed, 23 Nov 2022 08:28:02 +0100 From: Sascha Hauer To: Li Hua Cc: richard@nod.at, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, weiyongjun1@huawei.com, yusongping@huawei.com Subject: Re: [PATCH v2] ubifs: Fix build errors as symbol undefined Message-ID: <20221123072802.GC29978@pengutronix.de> References: <20221121111847.71648-1-hucool.lihua@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221121111847.71648-1-hucool.lihua@huawei.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 On Mon, Nov 21, 2022 at 07:18:47PM +0800, Li Hua wrote: > With CONFIG_UBIFS_FS_AUTHENTICATION not set, the compiler can assume that > ubifs_node_check_hash() is never true and drops the call to ubifs_bad_hash(). > Is CONFIG_CC_OPTIMIZE_FOR_SIZE enabled this optimization does not happen anymore. > > So When CONFIG_UBIFS_FS and CONFIG_CC_OPTIMIZE_FOR_SIZE is enabled but > CONFIG_UBIFS_FS_AUTHENTICATION is not set, the build errors is as followd: > ERROR: modpost: "ubifs_bad_hash" [fs/ubifs/ubifs.ko] undefined! > > Fix it by add no-op ubifs_bad_hash() for the CONFIG_UBIFS_FS_AUTHENTICATION=n case. > > Fixes: 16a26b20d2af ("ubifs: authentication: Add hashes to index nodes") > Signed-off-by: Li Hua Reviewed-by: Sascha Hauer Sascha > --- > fs/ubifs/ubifs.h | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h > index 478bbbb5382f..2f1f31581094 100644 > --- a/fs/ubifs/ubifs.h > +++ b/fs/ubifs/ubifs.h > @@ -1623,8 +1623,13 @@ static inline int ubifs_check_hmac(const struct ubifs_info *c, > return crypto_memneq(expected, got, c->hmac_desc_len); > } > > +#ifdef CONFIG_UBIFS_FS_AUTHENTICATION > void ubifs_bad_hash(const struct ubifs_info *c, const void *node, > const u8 *hash, int lnum, int offs); > +#else > +static inline void ubifs_bad_hash(const struct ubifs_info *c, const void *node, > + const u8 *hash, int lnum, int offs) {}; > +#endif > > int __ubifs_node_check_hash(const struct ubifs_info *c, const void *buf, > const u8 *expected); > -- > 2.17.1 > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |