[PATCH] dm table: get_target: fix last index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Milan Broz <[email protected]>

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 <[email protected]>
Signed-Off-By: Alasdair G Kergon <[email protected]>

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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux