Skip to content

Commit

Permalink
[PATCH] dm table: get_target: fix last index
Browse files Browse the repository at this point in the history
The table is indexed from 0, so an index equal to t->num_targets should be
rejected.

(There is no code in the current tree that would exercise this bug.)

Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Milan Broz authored and Linus Torvalds committed Jun 26, 2006
1 parent e4c8b3b commit 1435353
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ sector_t dm_table_get_size(struct dm_table *t)

struct dm_target *dm_table_get_target(struct dm_table *t, unsigned int index)
{
if (index > t->num_targets)
if (index >= t->num_targets)
return NULL;

return t->targets + index;
Expand Down

0 comments on commit 1435353

Please sign in to comment.