lkml.org 
[lkml]   [2007]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] dma_declare_coherent_memory wrong allocation
    From
    Date
    On Fri, 2007-04-13 at 20:08 +0200, Guennadi Liakhovetski wrote:
    > Either I've finally gone blind on this Friday 13th or... Looks like this
    > almost 3 year old function has a bug. Patch below compile-tested... in a
    > way.

    No, it's a longstanding bug in the x86 implementation, thanks for
    finding it.

    > - int bitmap_size = (pages + 31)/32;
    > + int bitmap_size = DIV_ROUND_UP(pages, 8);

    This isn't quite right. Bitmaps are arrays of longs, not arrays of
    bytes. The bug is forgetting that kmalloc() takes bytes ...

    How about

    int bitmap_size = DIV_ROUNDUP(pages, 32) * 4;

    ?

    James


    -
    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: 2007-04-22 18:55    [W:0.022 / U:62.064 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site