diff options
| author | Neil Brown <neilb@cse.unsw.edu.au> | 2003-03-26 18:57:36 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-03-26 18:57:36 -0800 |
| commit | dbeada9f07c659854ae8b063bbee4c95876db843 (patch) | |
| tree | 7d5b8c989d10ab775518a1254ad90c3b693423ea | |
| parent | c2dfcb95e30c9c9f3f4681ade0239cd6c3197736 (diff) | |
[PATCH] md: md/linear oops fix
From: Daniel McNeil <daniel@osdl.org>
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.
| -rw-r--r-- | drivers/md/linear.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 21a99219ccd7..5e7dccdca9f0 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c @@ -37,7 +37,11 @@ static inline dev_info_t *which_dev(mddev_t *mddev, sector_t sector) 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; |
