Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6821839rwb; Tue, 22 Nov 2022 20:29:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf5YEsA6Kdq3zUcJF5jdLWjBTbD4k8zdDbNLIt/j7o+B7KsJD2CDO3Rfm+LSCnbiG6JM+xWh X-Received: by 2002:a17:906:830d:b0:79e:5ea1:4f83 with SMTP id j13-20020a170906830d00b0079e5ea14f83mr8615307ejx.372.1669177774374; Tue, 22 Nov 2022 20:29:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669177774; cv=none; d=google.com; s=arc-20160816; b=Ew3L+BxSwIyIB2kGMZegOTRQjnsqGdYACmv2C3+5koZAbQsQHrSv1BM9FPq9BWW4jW 822YyorFq4tbNi48koBHrvjHywQTTKN2Mch9pP0Ikg1PmqoStw1aHZJnYgcLStD0la4u rnZtYstuPShH/gpYQU5jPnqnAMRq6Ma1ZPhogNXZb+BoXwRpjRpj9vhFSn7uNZ2xJ2EU +N+cFMh4tIPBwWsQNFVIx/92+Dhc5q/kUNFAdQGGjeWevlsKW2Dn1BOWH9XHsX5lVt4F j7rhJRln5pbDKSW2LQC9CqTJIzkxvVA1fbO7B9nGNUsaMVhYaZ3fCiGBhb868KACXlaq Oa7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=LkZ2l1cC84SCNum9+0+QDo8bO21vttTSLl5WrK4t73M=; b=aDBjZRfqsdGQLw8AKYn4Sx0hj2L7hoYbcP7PlbeDMb03bnHZRnWGVsWod1a0bBUeDU F5StN6Ae+UwRQRseZrvN5Dl67tUOKXKdcAwFrLGNWnqAjBsrDutrEJpmuhEDVoUyvlnM hpxW8JX3q5XLtnRhN+AGvlyv+gnro01VsKcrmgCRw7AjbTgrjWW4p1SmYozznu8Q0cM0 krgFbclL95wckrY78hVItR/gkfplDMtxgm1QG9RR0eQ5ElRBgWWw9esC/4OXYmMhoePt CibMwD3aQL/0DY5CCcFoylPb1m8Cjv65N8kahqLjUZkFfqUZHlNDwtZ8w1yG7BviCDAo choA== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ss2-20020a170907c00200b007806c141214si12019770ejc.153.2022.11.22.20.29.10; Tue, 22 Nov 2022 20:29:34 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235571AbiKWD3J (ORCPT + 89 others); Tue, 22 Nov 2022 22:29:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234070AbiKWD3H (ORCPT ); Tue, 22 Nov 2022 22:29:07 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77DD2C6555 for ; Tue, 22 Nov 2022 19:29:06 -0800 (PST) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NH6695YydzmW4H; Wed, 23 Nov 2022 11:28:33 +0800 (CST) Received: from [10.67.109.51] (10.67.109.51) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 23 Nov 2022 11:29:04 +0800 Message-ID: Date: Wed, 23 Nov 2022 11:29:04 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.2 Subject: Re: [PATCH v2] ubifs: Fix build errors as symbol undefined To: , CC: , , , References: <20221121111847.71648-1-hucool.lihua@huawei.com> From: "Lihua (lihua, ran)" In-Reply-To: <20221121111847.71648-1-hucool.lihua@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.109.51] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, 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 ping 在 2022/11/21 19:18, Li Hua 写道: > 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 > --- > 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); >