Colin Watson
2006-Dec-21  03:19 UTC
[klibc] fstype: Fix ext2 and ext3 size detection on big-endian systems
The following patch fixes ext2 and ext3 size detection on big-endian
systems by adding a couple of missing __le32_to_cpu calls.
Signed-off-by: Colin Watson <cjwatson at ubuntu.com>
diff -Nur klibc-1.4.30/usr/kinit/fstype/fstype.c
klibc-1.4.30.new/usr/kinit/fstype/fstype.c
--- klibc-1.4.30/usr/kinit/fstype/fstype.c	2006-12-21 03:11:21.000000000 +0000
+++ klibc-1.4.30.new/usr/kinit/fstype/fstype.c	2006-12-21 03:13:13.000000000
+0000
@@ -117,7 +117,7 @@
 	    sb->
 	    s_feature_compat & __cpu_to_le32(EXT3_FEATURE_COMPAT_HAS_JOURNAL)) {
 		*bytes = (unsigned long long)__le32_to_cpu(sb->s_blocks_count)
-		    << (10 + sb->s_log_block_size);
+		    << (10 + __le32_to_cpu(sb->s_log_block_size));
 		return 1;
 	}
 	return 0;
@@ -130,7 +130,7 @@
 
 	if (sb->s_magic == __cpu_to_le16(EXT2_SUPER_MAGIC)) {
 		*bytes = (unsigned long long)__le32_to_cpu(sb->s_blocks_count)
-		    << (10 + sb->s_log_block_size);
+		    << (10 + __le32_to_cpu(sb->s_log_block_size));
 		return 1;
 	}
 	return 0;
Thanks,
-- 
Colin Watson                                       [cjwatson at ubuntu.com]