lkml.org 
[lkml]   [2002]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    Subject6/19
    From
    minor change for dm-stripe.c. Tests for correct chunksize before it allocates
    the stripe context. [Heinz Mauelshagen]

    --- diff/drivers/md/dm-stripe.c 2002-11-18 10:11:54.000000000 +0000
    +++ source/drivers/md/dm-stripe.c 2002-12-16 09:40:48.000000000 +0000
    @@ -117,6 +117,14 @@
    return -EINVAL;
    }

    + /*
    + * chunk_size is a power of two
    + */
    + if (!chunk_size || (chunk_size & (chunk_size - 1))) {
    + ti->error = "dm-stripe: Invalid chunk size";
    + return -EINVAL;
    + }
    +
    if (!multiple(ti->len, stripes, &width)) {
    ti->error = "dm-stripe: Target length not divisable by "
    "number of stripes";
    @@ -134,15 +142,6 @@
    sc->stripe_width = width;
    ti->split_io = chunk_size;

    - /*
    - * chunk_size is a power of two
    - */
    - if (!chunk_size || (chunk_size & (chunk_size - 1))) {
    - ti->error = "dm-stripe: Invalid chunk size";
    - kfree(sc);
    - return -EINVAL;
    - }
    -
    sc->chunk_mask = ((sector_t) chunk_size) - 1;
    for (sc->chunk_shift = 0; chunk_size; sc->chunk_shift++)
    chunk_size >>= 1;
    -
    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: 2005-03-22 13:31    [W:0.021 / U:3.888 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site