Home
last modified time | relevance | path

Searched hist:"5 dfe2be7" (Results 1 – 1 of 1) sorted by relevance

/openbmc/linux/fs/btrfs/
H A Dctree.c5dfe2be7 Mon Feb 23 13:48:52 CST 2015 Filipe Manana <fdmanana@suse.com> Btrfs: fix off-by-one logic error in btrfs_realloc_node

The end_slot variable actually matches the number of pointers in the
node and not the last slot (which is 'nritems - 1'). Therefore in order
to check that the current slot in the for loop doesn't match the last
one, the correct logic is to check if 'i' is less than 'end_slot - 1'
and not 'end_slot - 2'.

Fix this and set end_slot to be 'nritems - 1', as it's less confusing
since the variable name implies it's inclusive rather then exclusive.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
5dfe2be7 Mon Feb 23 13:48:52 CST 2015 Filipe Manana <fdmanana@suse.com> Btrfs: fix off-by-one logic error in btrfs_realloc_node

The end_slot variable actually matches the number of pointers in the
node and not the last slot (which is 'nritems - 1'). Therefore in order
to check that the current slot in the for loop doesn't match the last
one, the correct logic is to check if 'i' is less than 'end_slot - 1'
and not 'end_slot - 2'.

Fix this and set end_slot to be 'nritems - 1', as it's less confusing
since the variable name implies it's inclusive rather then exclusive.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>