diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2014-12-10 18:41:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:03 -0500 |
commit | 519a286175b6422e13694ebb73aefee0b5749443 (patch) | |
tree | 9be49e211258e1d6eb874f55f357f710406b9ba4 /fs/ocfs2 | |
parent | f08736bd6c54c33b91d4324eee5713ca6f13319a (diff) |
ocfs2: fix an off-by-one BUG_ON() statement
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>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/slot_map.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ocfs2/slot_map.c b/fs/ocfs2/slot_map.c index a88b2a4fcc85..d5493e361a38 100644 --- a/fs/ocfs2/slot_map.c +++ b/fs/ocfs2/slot_map.c | |||
@@ -306,7 +306,7 @@ int ocfs2_slot_to_node_num_locked(struct ocfs2_super *osb, int slot_num, | |||
306 | assert_spin_locked(&osb->osb_lock); | 306 | assert_spin_locked(&osb->osb_lock); |
307 | 307 | ||
308 | BUG_ON(slot_num < 0); | 308 | BUG_ON(slot_num < 0); |
309 | BUG_ON(slot_num > osb->max_slots); | 309 | BUG_ON(slot_num >= osb->max_slots); |
310 | 310 | ||
311 | if (!si->si_slots[slot_num].sl_valid) | 311 | if (!si->si_slots[slot_num].sl_valid) |
312 | return -ENOENT; | 312 | return -ENOENT; |