On Wed, 07 Aug 2013 14:26:18 +0900 Joonyoung Shim <[email protected]> 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 <[email protected]> Subject: genalloc-fix-overflow-of-ending-address-of-memory-chunk-fix add comment to struct gen_pool_chunk:end_addr Cc: Joonyoung Shim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> --- 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

