Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4099628rwb; Mon, 21 Nov 2022 03:49:06 -0800 (PST) X-Google-Smtp-Source: AA0mqf5BO+YTtmr3Ycy2OY0pjITidIZKAIIRTYnP2lfV2MbEz+52OK3vrUgtbloO7c7wcoZClivY X-Received: by 2002:aa7:cc08:0:b0:461:8a43:e93 with SMTP id q8-20020aa7cc08000000b004618a430e93mr15214990edt.275.1669031345913; Mon, 21 Nov 2022 03:49:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669031345; cv=none; d=google.com; s=arc-20160816; b=Zm3F6X7VW5Sh2s0fronh8TeXtv5+z48f5wWx/UiU6dJXkxwV88q+fdlyS6gK4w+5Br 3qplC5voIDi44isiu4idOHYBnBkQHgDBvb9rPTkiktWmeLgiOUZWMdT94jdECC9HYm9M ArtndYbZpi8MT2DinisysBI/8bqiqHGHEkTEhUAfoOn4wGC+zJekLHhu4vNonM0kQ/Wl yLDCi/2rVi1XxD5N8lqrl76D+jZ0XWmTLnIztt5ot7lWXdOHTdh7d7p5qhdnBD0rjLy8 2PnBDKENbwoV2ipKradJn+k0SwZRKfHqGvDxUzzeqBRsLaO/kNFQ7YB8SgstDF3TZhP7 wBzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=ddXyxdKKiujzxqQ6CPzcYbP9LHWzcPUPPLg7/S3e21w=; b=hIU7DKc+isekaBHoTuoykP08HA3t7Yzirty+dnloXrz+T53YYlQcbHA8cK6l8gzDFe Bz7yfKghbs5vqPmaTMLQKYgJhsDCSov6/9cxOwkqKaatwCfcV+7PHUv6teH2XPSgRe58 W2tXEcZETHNwGOaqC0IUA2AvDREgtGNkhYSJYrdUrTsq6u+PffGAlVldqGvxjljs8pSc H4zoIi54L7a8nMIxxKyldhoBMQX5wY9uE93LZxVRHd6wDnB0yornfSf28TE6uYYsvlQg COXecQdGOJ5Te0sGvUoE0ZGtr6sgJ6/YHOMJh85Pwr5jl8RvkyWiXgUELyO3KG9UinIu sy+Q== 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 q15-20020a056402248f00b004534c7d4ebfsi9356288eda.434.2022.11.21.03.48.42; Mon, 21 Nov 2022 03:49:05 -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 S229674AbiKUKuI (ORCPT + 92 others); Mon, 21 Nov 2022 05:50:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbiKUKuG (ORCPT ); Mon, 21 Nov 2022 05:50:06 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD064B84A for ; Mon, 21 Nov 2022 02:50:04 -0800 (PST) Received: from canpemm500009.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NG3w15Qf4zqSb3; Mon, 21 Nov 2022 18:46:09 +0800 (CST) Received: from huawei.com (10.67.174.191) 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; Mon, 21 Nov 2022 18:50:02 +0800 From: Li Hua To: , CC: , , , , Subject: [PATCH v2] ubifs: Fix build errors as symbol undefined Date: Mon, 21 Nov 2022 19:18:47 +0800 Message-ID: <20221121111847.71648-1-hucool.lihua@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.174.191] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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,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 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); -- 2.17.1