Re: [PATCH] dma_declare_coherent_memory wrong allocation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux