[PATCH] dm table: get_target: fix last index

From: Alasdair G Kergon
Date: Tue May 30 2006 - 12:56:37 EST


From: Milan Broz <mbroz@xxxxxxxxxx>

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@xxxxxxxxxx>
Signed-Off-By: Alasdair G Kergon <agk@xxxxxxxxxx>

Index: linux-2.6.17-rc4/drivers/md/dm-table.c
===================================================================
--- linux-2.6.17-rc4.orig/drivers/md/dm-table.c 2006-05-25 19:06:52.000000000 +0100
+++ linux-2.6.17-rc4/drivers/md/dm-table.c 2006-05-30 17:18:50.000000000 +0100
@@ -802,7 +802,7 @@ sector_t dm_table_get_size(struct dm_tab

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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/