linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.5.65] md/linear oops fix
@ 2003-03-18 18:45 Daniel McNeil
  0 siblings, 0 replies; only message in thread
From: Daniel McNeil @ 2003-03-18 18:45 UTC (permalink / raw)
  To: NeilBrown, Ingo Molnar; +Cc: linux-raid, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 185 bytes --]

This fixes an oops caused by incorrect usage of sector_div()
in which_dev() in md/linear.c.  It was dereferencing an non-existent
hash table entry.

-- 
Daniel McNeil <daniel@osdl.org>

[-- Attachment #2: patch-2.5.65-linear --]
[-- Type: text/x-patch, Size: 682 bytes --]

diff -urNp -X /home/daniel/dontdiff linux-2.5.65/drivers/md/linear.c linux-2.5.65-md/drivers/md/linear.c
--- linux-2.5.65/drivers/md/linear.c	Mon Mar 17 13:44:04 2003
+++ linux-2.5.65-md/drivers/md/linear.c	Tue Mar 18 09:34:09 2003
@@ -37,7 +37,11 @@ static inline dev_info_t *which_dev(mdde
 	linear_conf_t *conf = mddev_to_conf(mddev);
 	sector_t block = sector >> 1;
 
-	hash = conf->hash_table + sector_div(block, conf->smallest->size);
+	/*
+	 * sector_div(a,b) returns the remainer and sets a to a/b
+	 */
+	(void)sector_div(block, conf->smallest->size);
+	hash = conf->hash_table + block;
 
 	if ((sector>>1) >= (hash->dev0->size + hash->dev0->offset))
 		return hash->dev1;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-18 18:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-18 18:45 [PATCH 2.5.65] md/linear oops fix Daniel McNeil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).