From patchwork Mon Nov 21 11:18:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lihua (lihua, ran)" X-Patchwork-Id: 23657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1507969wrr; Mon, 21 Nov 2022 02:52:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf6fBZwhfYA9ZansCPk+Aq8WABhG1iU3yMYRIvMm20r+mBkCMEfIL8oh0XE98Hmi5vAcsYH5 X-Received: by 2002:aa7:c844:0:b0:461:a130:ea3c with SMTP id g4-20020aa7c844000000b00461a130ea3cmr15224221edt.272.1669027940388; Mon, 21 Nov 2022 02:52:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669027940; cv=none; d=google.com; s=arc-20160816; b=oNEZb5fd0IgsqXRS4otVfbR7x8Jnlgp1o4enoF0PwL/vM3W1g1iZEqlcz+vZ4YNm+F vdWwaS0Wo9/lOL5VuqKq9r0VpiUpn5SxpHkEktvpmAT+LrsMGe6z284OnlEYVDSEWnMD mQ1mBXYHQsTJc6ZJMdzDWKTF/LbRpPy1siRqkBEl8TVG82EzMh2ptqxCHlEPOi9U9jIq /HzHFtBkc9PXjx9FEvrZduRE2anRVuD2eJ9OCvCrkk2ik5DDtCuIY/l83ONO419b9WBM 2HLnBpsUKcNJz2lrERexBiLhqOv5BP/Z48n+62UA3XexfZSsl3YqjjnYOAc4yRIyIYL8 nO0Q== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht20-20020a170907609400b00782035a06b4si9888959ejc.200.2022.11.21.02.51.56; Mon, 21 Nov 2022 02:52:20 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749548624420790575?= X-GMAIL-MSGID: =?utf-8?q?1750102641654595519?= 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 --- 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);