lkml.org 
[lkml]   [2006]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateTue, 30 May 2006 17:57:04 +0100
FromAlasdair G Kergon <>
Subject[PATCH] dm table: get_target: fix last index
From: Milan Broz <mbroz@redhat.com>

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>

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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-05-30 18:59    [from the cache]
©2003-2010