mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley@SteelEye.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma_declare_coherent_memory wrong allocation
Date: Sun, 22 Apr 2007 11:52:05 -0500	[thread overview]
Message-ID: <1177260725.4268.9.camel@mulgrave.il.steeleye.com> (raw)
In-Reply-To: <Pine.LNX.4.60.0704132000030.5919@poirot.grange>

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



  parent reply	other threads:[~2007-04-22 16:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-13 18:08 Guennadi Liakhovetski
2007-04-21  7:08 ` Andrew Morton
2007-04-21 11:01   ` Guennadi Liakhovetski
2007-04-22 16:52 ` James Bottomley [this message]
2007-04-22 22:45   ` Guennadi Liakhovetski
2007-04-22 22:49     ` Guennadi Liakhovetski
2007-04-23 15:58     ` James Bottomley
2007-04-23 20:45       ` Guennadi Liakhovetski
2007-04-26 13:47         ` James Bottomley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1177260725.4268.9.camel@mulgrave.il.steeleye.com \
    --to=james.bottomley@steeleye.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®