ext4_fs: fix possible overflow
authorgkostka <kostka.grzegorz@gmail.com>
Tue, 12 Apr 2016 15:43:13 +0000 (17:43 +0200)
committergkostka <kostka.grzegorz@gmail.com>
Tue, 12 Apr 2016 15:43:13 +0000 (17:43 +0200)
include/ext4_fs.h

index b598c5e1430ad270c7c5e79ccf7dc638ef566ca6..9653f47878c514da1804088f3fb7d348d09851ce 100644 (file)
@@ -94,7 +94,7 @@ struct ext4_inode_ref {
 static inline uint32_t ext4_fs_addr_to_idx_bg(struct ext4_sblock *s,
                                                     ext4_fsblk_t baddr)
 {
-       if (ext4_get32(s, first_data_block))
+       if (ext4_get32(s, first_data_block) && baddr)
                baddr--;
 
        return baddr % ext4_get32(s, blocks_per_group);