* [PATCH v2] ubifs: Fix build errors as symbol undefined
@ 2022-11-21 11:18 Li Hua
2022-11-23 3:29 ` Lihua (lihua, ran)
2022-11-23 7:28 ` Sascha Hauer
0 siblings, 2 replies; 4+ messages in thread
From: Li Hua @ 2022-11-21 11:18 UTC (permalink / raw)
To: richard, s.hauer
Cc: linux-mtd, linux-kernel, weiyongjun1, yusongping, hucool.lihua
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 <hucool.lihua@huawei.com>
---
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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ubifs: Fix build errors as symbol undefined
2022-11-21 11:18 [PATCH v2] ubifs: Fix build errors as symbol undefined Li Hua
@ 2022-11-23 3:29 ` Lihua (lihua, ran)
2022-11-23 7:35 ` Richard Weinberger
2022-11-23 7:28 ` Sascha Hauer
1 sibling, 1 reply; 4+ messages in thread
From: Lihua (lihua, ran) @ 2022-11-23 3:29 UTC (permalink / raw)
To: richard, s.hauer; +Cc: linux-mtd, linux-kernel, weiyongjun1, yusongping
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 <hucool.lihua@huawei.com>
> ---
> 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);
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ubifs: Fix build errors as symbol undefined
2022-11-21 11:18 [PATCH v2] ubifs: Fix build errors as symbol undefined Li Hua
2022-11-23 3:29 ` Lihua (lihua, ran)
@ 2022-11-23 7:28 ` Sascha Hauer
1 sibling, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2022-11-23 7:28 UTC (permalink / raw)
To: Li Hua; +Cc: richard, linux-mtd, linux-kernel, weiyongjun1, yusongping
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 <hucool.lihua@huawei.com>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
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 |
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] ubifs: Fix build errors as symbol undefined
2022-11-23 3:29 ` Lihua (lihua, ran)
@ 2022-11-23 7:35 ` Richard Weinberger
0 siblings, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2022-11-23 7:35 UTC (permalink / raw)
To: Lihua; +Cc: Sascha Hauer, linux-mtd, linux-kernel, Wei Yongjun, yusongping
----- Ursprüngliche Mail -----
> Von: "Lihua" <hucool.lihua@huawei.com>
> An: "richard" <richard@nod.at>, "Sascha Hauer" <s.hauer@pengutronix.de>
> CC: "linux-mtd" <linux-mtd@lists.infradead.org>, "linux-kernel" <linux-kernel@vger.kernel.org>, "Wei Yongjun"
> <weiyongjun1@huawei.com>, "yusongping" <yusongping@huawei.com>
> Gesendet: Mittwoch, 23. November 2022 04:29:04
> Betreff: Re: [PATCH v2] ubifs: Fix build errors as symbol undefined
> ping
While I'm perfectly fine with pinging, because I'm more busy than I want to,
pinging after less than 48 hours is a little aggressive.
Thanks,
//richard
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-23 7:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 11:18 [PATCH v2] ubifs: Fix build errors as symbol undefined Li Hua
2022-11-23 3:29 ` Lihua (lihua, ran)
2022-11-23 7:35 ` Richard Weinberger
2022-11-23 7:28 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).