[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20130809161357.5a1d5c0ff6f5bedb8a66be86@linux-foundation.org>
Date: Fri, 9 Aug 2013 16:13:57 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Joonyoung Shim <jy0922.shim@...sung.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] genalloc: fix overflow of ending address of memory
chunk
On Wed, 07 Aug 2013 14:26:18 +0900 Joonyoung Shim <jy0922.shim@...sung.com> wrote:
> In struct gen_pool_chunk, end_addr means ending address of memory chunk,
> but actually it is starting address + size of memory chunk in codes, so
> it points the address increased one instead of correct ending address.
>
> The ending address of memory chunk increased one will cause overflow on
> the case to use memory chunk including last address of memory map, e.g.
> when starting address is 0xFFF00000 and size is 0x100000 on 32bit
> machine, ending address will be 0x100000000.
>
> Use correct ending address like starting address + size - 1.
This might help:
From: Andrew Morton <akpm@...ux-foundation.org>
Subject: genalloc-fix-overflow-of-ending-address-of-memory-chunk-fix
add comment to struct gen_pool_chunk:end_addr
Cc: Joonyoung Shim <jy0922.shim@...sung.com>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
---
include/linux/genalloc.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff -puN lib/genalloc.c~genalloc-fix-overflow-of-ending-address-of-memory-chunk-fix lib/genalloc.c
diff -puN include/linux/genalloc.h~genalloc-fix-overflow-of-ending-address-of-memory-chunk-fix include/linux/genalloc.h
--- a/include/linux/genalloc.h~genalloc-fix-overflow-of-ending-address-of-memory-chunk-fix
+++ a/include/linux/genalloc.h
@@ -66,8 +66,8 @@ struct gen_pool_chunk {
struct list_head next_chunk; /* next chunk in pool */
atomic_t avail;
phys_addr_t phys_addr; /* physical starting address of memory chunk */
- unsigned long start_addr; /* starting address of memory chunk */
- unsigned long end_addr; /* ending address of memory chunk */
+ unsigned long start_addr; /* start address of memory chunk */
+ unsigned long end_addr; /* end address of memory chunk (inclusive) */
unsigned long bits[0]; /* bitmap for allocating memory chunk */
};
_
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists