]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ocfs2: fix incorrect CPU endianness conversion causing mount failure
authorHeming Zhao <heming.zhao@suse.com>
Tue, 21 Jan 2025 11:22:03 +0000 (19:22 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 1 Feb 2025 11:53:24 +0000 (03:53 -0800)
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.

Link: https://lkml.kernel.org/r/20250121112204.12834-1-heming.zhao@suse.com
Fixes: 23aab037106d ("ocfs2: fix UBSAN warning in ocfs2_verify_volume()")
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/super.c

index e0b91dbaa0acbd3f0c31231b4f74b8d35d956caa..8bb5022f30824b42e3a0daffee858321fb31f0ef 100644 (file)
@@ -2285,7 +2285,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) !=