Re: [PATCH] mm: fix overflow in vm_map_ram

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

 



On 20 April 2016 at 12:53:41, Guillermo Julián Moreno (guillermo.julian@xxxxxxxxx(mailto:guillermo.julian@xxxxxxxxx)) wrote:

>  
> When remapping pages accounting for 4G or more memory space, the
> operation 'count << PAGE_SHIFT' overflows as it is performed on an
> integer. Solution: cast before doing the bitshift.
>  
> Signed-off-by: Guillermo Julián  
> ---
> mm/vmalloc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>  
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index ae7d20b..97257e4 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -1114,7 +1114,7 @@ EXPORT_SYMBOL(vm_unmap_ram);
> */
> void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t prot)
> {
> - unsigned long size = count << PAGE_SHIFT;
> + unsigned long size = ((unsigned long) count) << PAGE_SHIFT;
> unsigned long addr;
> void *mem;
>  
> @@ -1484,7 +1484,7 @@ static void __vunmap(const void *addr, int deallocate_pages)
> kfree(area);
> return;
> }
> -
> +
> /**
> * vfree - release memory allocated by vmalloc()
> * @addr: memory base address
> --
> 1.8.3.1

Hello, has anyone taken a look at this patch?

Guillermo Julián



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]