From 143535396c7ebd9395a931a000b3963f457712b8 Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Mon, 26 Jun 2006 00:27:27 -0700 Subject: [PATCH] [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 Signed-off-by: Alasdair G Kergon Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/md/dm-table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 8f56a54cf0c..b6183eda810 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -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; -- 2.20.1