Skip to content

Commit

Permalink
ocfs2: fix an off-by-one BUG_ON() statement
Browse files Browse the repository at this point in the history
The ->si_slots[] array is allocated in ocfs2_init_slot_info() it has
"->max_slots" number of elements so this test should be >= instead of >.

Static checker work.  Compile tested only.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Dan Carpenter authored and Linus Torvalds committed Dec 11, 2014
1 parent f08736b commit 519a286
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ocfs2/slot_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ int ocfs2_slot_to_node_num_locked(struct ocfs2_super *osb, int slot_num,
assert_spin_locked(&osb->osb_lock);

BUG_ON(slot_num < 0);
BUG_ON(slot_num > osb->max_slots);
BUG_ON(slot_num >= osb->max_slots);

if (!si->si_slots[slot_num].sl_valid)
return -ENOENT;
Expand Down

0 comments on commit 519a286

Please sign in to comment.