Commit:     787f17feb204ed1c6331892fb8124b80dc9fe288
Parent:     1dbf37e8adf1ab6b82a510d5e69fa676ed9717c4
Author:     NeilBrown <[EMAIL PROTECTED]>
AuthorDate: Wed May 23 13:58:09 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed May 23 20:14:14 2007 -0700

    md: avoid overflow in raid0 calculation with large components
    If a raid0 has a component device larger than 4TB, and is accessed on a 
    machines, then as 'chunk' is unsigned long,
       chunk << chunksize_bits
    can overflow (this can be as high as the size of the device in KB).  chunk
    itself will not overflow (without triggering a BUG).
    So change 'chunk' to be 'sector_t, and get rid of the 'BUG' as it becomes
    impossible to hit.
    Cc: "Jeff Zheng" <[EMAIL PROTECTED]>
    Signed-off-by: Neil Brown <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 drivers/md/raid0.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index dfe3214..2c404f7 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -415,7 +415,7 @@ static int raid0_make_request (request_queue_t *q, struct 
bio *bio)
        raid0_conf_t *conf = mddev_to_conf(mddev);
        struct strip_zone *zone;
        mdk_rdev_t *tmp_dev;
-       unsigned long chunk;
+       sector_t chunk;
        sector_t block, rsect;
        const int rw = bio_data_dir(bio);
@@ -470,7 +470,6 @@ static int raid0_make_request (request_queue_t *q, struct 
bio *bio)
                sector_div(x, zone->nb_dev);
                chunk = x;
-               BUG_ON(x != (sector_t)chunk);
                x = block >> chunksize_bits;
                tmp_dev = zone->dev[sector_div(x, zone->nb_dev)];
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to