mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Toshi Kikuchi <toshik@chromium.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lib/genalloc.c: fix the end addr check in addr_in_gen_pool()
Date: Mon, 22 Dec 2014 13:05:39 -0800	[thread overview]
Message-ID: <20141222130539.8bcb58ffa9db2258204bf807@linux-foundation.org> (raw)
In-Reply-To: <1418956259-13003-1-git-send-email-toshik@chromium.org>

On Thu, 18 Dec 2014 18:30:59 -0800 Toshi Kikuchi <toshik@chromium.org> wrote:

> Since chunk->end_addr is (chunk->start_addr + size - 1),
> the end address to compare should be (start + size - 1).
> 
> Signed-off-by: Toshi Kikuchi <toshik@chromium.org>
> ---
>  lib/genalloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/genalloc.c b/lib/genalloc.c
> index 2e65d20..42a95e9 100644
> --- a/lib/genalloc.c
> +++ b/lib/genalloc.c
> @@ -415,7 +415,7 @@ bool addr_in_gen_pool(struct gen_pool *pool, unsigned long start,
>  			size_t size)
>  {
>  	bool found = false;
> -	unsigned long end = start + size;
> +	unsigned long end = start + size - 1;
>  	struct gen_pool_chunk *chunk;
>  
>  	rcu_read_lock();

urgh.  gen_pool_chunk.end_addr should have been made exclusive, not
inclusive.  Or switch to start_addr/size.  The code would be
considerably nicer that way.

And the struct gen_pool_chunk definition should be moved into
genalloc.c.  I'm not sure what drivers/acpi/apei/ghes.c is doing
fiddling around with genalloc internals, but it should stop doing it.

Sigh :(

      reply	other threads:[~2014-12-22 21:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19  2:30 Toshi Kikuchi
2014-12-22 21:05 ` Andrew Morton [this message]

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=20141222130539.8bcb58ffa9db2258204bf807@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=toshik@chromium.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®