]> err.no Git - linux-2.6/commitdiff
[PATCH] dm table: get_target: fix last index
authorMilan Broz <mbroz@redhat.com>
Mon, 26 Jun 2006 07:27:27 +0000 (00:27 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 26 Jun 2006 16:58:35 +0000 (09:58 -0700)
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>
drivers/md/dm-table.c

index 8f56a54cf0ce5eefe2a742f79a65e49dd21f0fbc..b6183eda8106e8ac38af19e4c0603632bba073af 100644 (file)
@@ -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;