shithub: lwext4

Download patch

ref: af5034292e3db3d9db5f31479185ef65f8a1cf9a
parent: 44ce3df15ccdbf6dd79801b9320c1eed690496e8
author: gkostka <kostka.grzegorz@gmail.com>
date: Tue Apr 12 13:43:13 EDT 2016

ext4_fs: fix possible overflow

--- a/include/ext4_fs.h
+++ b/include/ext4_fs.h
@@ -94,7 +94,7 @@
 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);