Skip to contentSkip to conversation

ext4: remove unreachable statement inside __es_insert_extent()

PATCH In review Austin Kim 2 participants 2 messages Aug 22, 2019 ext4 file system

lore
Share & tools
lore

Austin Kim

author
#0 lore raw

PATCH 1/1 ext4: remove unreachable statement inside __es_insert_extent()

__es_insert_extent() never returns -EINVAL after BUG is executed. So remove unreachable code.

---
 fs/ext4/extents_status.c | 1 -
 1 file changed, 1 deletion(-)
fs/ext4/extents_status.c +0 -1
index a959adc..7f97360 100644
@@ -781,7 +781,6 @@ static int __es_insert_extent(struct inode *inode, struct extent_status *newes)
 			p = &(*p)->rb_right;
 		} else {
 			BUG();
-			return -EINVAL;
 		}
 	}
 
Signature · 1 line
2.6.2
maintainer
#1 lore raw
Quoted 11 lines · Austin Kim

__es_insert_extent() never returns -EINVAL after BUG is executed. So remove unreachable code.

---
 fs/ext4/extents_status.c | 1 -
 1 file changed, 1 deletion(-)
fs/ext4/extents_status.c +0 -0
index a959adc..7f97360 100644

fs/ext4/extents_status.c static int __es_insert_extent(struct inode *inode, struct extent_status *newes) · line 784

Quoted 4 lines
fs/ext4/extents_status.c +0 -1
@@ -781,7 +781,6 @@ static int __es_insert_extent(struct inode *inode, struct extent_status *newes)
 			p = &(*p)->rb_right;
 		} else {
 			BUG();
-			return -EINVAL;

This would not be safe in the case of !CONFIG_BUG. (See init/Kconfig)

It's fair to argue that we shouldn't have CONFIG_BUG --- or !CONFIG_BUG should still cause the kernel to stop without actually printing the full BUG information, for those tiny kernel applications which are really worried about kernel text space.

It also would be fair to argue that we should remove the unreachable annotation for BUG(), or even, add a *reachable* annotation to catch code where something something terribly might happen if the kernel is built with !CONFIG_BUG and we trip against a bug.

But this is a much higher level issue than your sending individual paches subsystems.

Regards,

- Ted