mirror of
https://github.com/torvalds/linux
synced 2024-11-05 18:23:50 +00:00
[PATCH] dm table: get_target: fix last index
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>
This commit is contained in:
parent
e4c8b3ba34
commit
143535396c
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue