Skip to contentSkip to conversation

fs/ext4: fix partition size get truncated in calculation

PATCH In review Ma Haijun 2 participants 2 messages Jan 7, 2014 – Jan 20, 2014 ext4 file system

lore
Share & tools
lore

Ma Haijun

author
#0 lore raw

PATCH 1/1 fs/ext4: fix partition size get truncated in calculation

It may cause file system corruption when do a write operation. This issue only affects boards that use 32 bit lbaint_t.

---
 fs/ext4/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/dev.c +1 -1
index 787e041..e0b513a 100644
@@ -41,7 +41,7 @@ void ext4fs_set_blk_dev(block_dev_desc_t *rbdd, disk_partition_t *info)
 	get_fs()->dev_desc = rbdd;
 	part_info = info;
 	part_offset = info->start;
-	get_fs()->total_sect = (info->size * info->blksz) >>
+	get_fs()->total_sect = ((uint64_t)info->size * info->blksz) >>
 		get_fs()->dev_desc->log2blksz;
 }
 
Signature · 1 line
1.8.3.2
#1 lore raw
Quoted 4 lines · Ma Haijun

It may cause file system corruption when do a write operation. This issue only affects boards that use 32 bit lbaint_t.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140120/2235e97e/attachment.pgp>