Skip to contentSkip to conversation

ext4: MMP: Fix endianness bug.

PATCH Applied [email protected] 4 participants 4 messages Feb 23, 2012 – Feb 27, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4: MMP: Fix endianness bug.

From: Santosh Nayak <[email protected]>

Sparse complaint this endian bug in ext4: mmp.

---
 fs/ext4/mmp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/ext4/mmp.c +2 -2
index 7ea4ba4..ed6548d 100644
@@ -257,8 +257,8 @@ int ext4_multi_mount_protect(struct super_block *sb,
 	 * If check_interval in MMP block is larger, use that instead of
 	 * update_interval from the superblock.
 	 */
-	if (mmp->mmp_check_interval > mmp_check_interval)
-		mmp_check_interval = mmp->mmp_check_interval;
+	if (le16_to_cpu(mmp->mmp_check_interval) > mmp_check_interval)
+		mmp_check_interval = le16_to_cpu(mmp->mmp_check_interval);
 
 	seq = le32_to_cpu(mmp->mmp_seq);
 	if (seq == EXT4_MMP_SEQ_CLEAN)
Signature · 1 line
1.7.4.4
Reviewed-by on v1 1/1
#1 lore raw

fs/ext4/mmp.c int ext4_multi_mount_protect(struct super_block *sb, · line 261

Quoted 8 lines · On Fri, Feb 24, 2012 at 12:39:05AM +0530, [email protected] wrote:
fs/ext4/mmp.c +2 -2
@@ -257,8 +257,8 @@ int ext4_multi_mount_protect(struct super_block *sb,
 	 * If check_interval in MMP block is larger, use that instead of
 	 * update_interval from the superblock.
 	 */
-	if (mmp->mmp_check_interval > mmp_check_interval)
-		mmp_check_interval = mmp->mmp_check_interval;
+	if (le16_to_cpu(mmp->mmp_check_interval) > mmp_check_interval)
+		mmp_check_interval = le16_to_cpu(mmp->mmp_check_interval);

Looks good to me.

Johann

Reviewed-by on v1 1/1
#2 lore raw
In reply to [email protected]
Quoted 5 lines · On 2012-02-23, at 12:09, [email protected] wrote:

From: Santosh Nayak <[email protected]>

Sparse complaint this endian bug in ext4: mmp.

Looks good.

Quoted 22 lines

---
fs/ext4/mmp.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
fs/ext4/mmp.c +2 -2
index 7ea4ba4..ed6548d 100644
@@ -257,8 +257,8 @@ int ext4_multi_mount_protect(struct super_block *sb,
    * If check_interval in MMP block is larger, use that instead of
    * update_interval from the superblock.
    */
-    if (mmp->mmp_check_interval > mmp_check_interval)
-        mmp_check_interval = mmp->mmp_check_interval;
+    if (le16_to_cpu(mmp->mmp_check_interval) > mmp_check_interval)
+        mmp_check_interval = le16_to_cpu(mmp->mmp_check_interval);
 
   seq = le32_to_cpu(mmp->mmp_seq);
   if (seq == EXT4_MMP_SEQ_CLEAN)
Signature · 1 line
1.7.4.4