mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ocfs2: Fix incorrect CPU endianness conversion causing mount failure
@ 2025-01-21 11:22 Heming Zhao
  2025-01-21 11:33 ` Joseph Qi
  0 siblings, 1 reply; 2+ messages in thread
From: Heming Zhao @ 2025-01-21 11:22 UTC (permalink / raw)
  To: joseph.qi; +Cc: Heming Zhao, ocfs2-devel, linux-kernel

Commit 23aab037106d ("ocfs2: fix UBSAN warning in ocfs2_verify_volume()")
introduced a regression bug. The blksz_bits value is already converted
to CPU endian in the previous code; therefore, the code shouldn't use
le32_to_cpu() anymore.

Fixes: 23aab037106d ("ocfs2: fix UBSAN warning in ocfs2_verify_volume()")
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
 fs/ocfs2/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index c79b4291777f..1e87554f6f41 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -2340,7 +2340,7 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di,
 			mlog(ML_ERROR, "found superblock with incorrect block "
 			     "size bits: found %u, should be 9, 10, 11, or 12\n",
 			     blksz_bits);
-		} else if ((1 << le32_to_cpu(blksz_bits)) != blksz) {
+		} else if ((1 << blksz_bits) != blksz) {
 			mlog(ML_ERROR, "found superblock with incorrect block "
 			     "size: found %u, should be %u\n", 1 << blksz_bits, blksz);
 		} else if (le16_to_cpu(di->id2.i_super.s_major_rev_level) !=
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ocfs2: Fix incorrect CPU endianness conversion causing mount failure
  2025-01-21 11:22 [PATCH] ocfs2: Fix incorrect CPU endianness conversion causing mount failure Heming Zhao
@ 2025-01-21 11:33 ` Joseph Qi
  0 siblings, 0 replies; 2+ messages in thread
From: Joseph Qi @ 2025-01-21 11:33 UTC (permalink / raw)
  To: Heming Zhao, akpm; +Cc: ocfs2-devel, linux-kernel



On 2025/1/21 19:22, Heming Zhao wrote:
> Commit 23aab037106d ("ocfs2: fix UBSAN warning in ocfs2_verify_volume()")
> introduced a regression bug. The blksz_bits value is already converted
> to CPU endian in the previous code; therefore, the code shouldn't use
> le32_to_cpu() anymore.
> 
> Fixes: 23aab037106d ("ocfs2: fix UBSAN warning in ocfs2_verify_volume()")
> Signed-off-by: Heming Zhao <heming.zhao@suse.com>

Thanks for pointing out this issue.

Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>

> ---
>  fs/ocfs2/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
> index c79b4291777f..1e87554f6f41 100644
> --- a/fs/ocfs2/super.c
> +++ b/fs/ocfs2/super.c
> @@ -2340,7 +2340,7 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di,
>  			mlog(ML_ERROR, "found superblock with incorrect block "
>  			     "size bits: found %u, should be 9, 10, 11, or 12\n",
>  			     blksz_bits);
> -		} else if ((1 << le32_to_cpu(blksz_bits)) != blksz) {
> +		} else if ((1 << blksz_bits) != blksz) {
>  			mlog(ML_ERROR, "found superblock with incorrect block "
>  			     "size: found %u, should be %u\n", 1 << blksz_bits, blksz);
>  		} else if (le16_to_cpu(di->id2.i_super.s_major_rev_level) !=


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-21 11:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-21 11:22 [PATCH] ocfs2: Fix incorrect CPU endianness conversion causing mount failure Heming Zhao
2025-01-21 11:33 ` Joseph Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®