Skip to contentSkip to conversation

fsck.f2fs: swap checkpoint crc to CPU endian

PATCH New Sheng Yong 1 participant 1 message Jan 14, 2016

lore
Share & tools
lore

Sheng Yong

author
#0 lore raw

PATCH 1/1 fsck.f2fs: swap checkpoint crc to CPU endian

---
 fsck/mount.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fsck/mount.c +2 -2
index c758774..b5fbaaa 100644
@@ -390,7 +390,7 @@ void *validate_checkpoint(struct f2fs_sb_info *sbi, block_t cp_addr,
 	if (crc_offset >= blk_size)
 		goto invalid_cp1;
 
-	crc = *(unsigned int *)((unsigned char *)cp + crc_offset);
+	crc = le32_to_cpu(*(__le32 *)((unsigned char *)cp + crc_offset));
 	if (f2fs_crc_valid(crc, cp, crc_offset))
 		goto invalid_cp1;
 
@@ -408,7 +408,7 @@ void *validate_checkpoint(struct f2fs_sb_info *sbi, block_t cp_addr,
 	if (crc_offset >= blk_size)
 		goto invalid_cp2;
 
-	crc = *(unsigned int *)((unsigned char *)cp + crc_offset);
+	crc = le32_to_cpu(*(__le32 *)((unsigned char *)cp + crc_offset));
 	if (f2fs_crc_valid(crc, cp, crc_offset))
 		goto invalid_cp2;
 
Signature · 9 lines
1.9.1


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140