linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: fix overflow in vm_map_ram
@ 2016-04-20 10:53 Guillermo Julián Moreno
  2016-05-26  7:38 ` Guillermo Julián Moreno
  2016-05-26 21:28 ` Andrew Morton
  0 siblings, 2 replies; 5+ messages in thread
From: Guillermo Julián Moreno @ 2016-04-20 10:53 UTC (permalink / raw)
  To: linux-mm


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 <guillermo.julian@naudit.es>
---
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

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-27 20:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-20 10:53 [PATCH] mm: fix overflow in vm_map_ram Guillermo Julián Moreno
2016-05-26  7:38 ` Guillermo Julián Moreno
2016-05-26 21:28 ` Andrew Morton
2016-05-27  8:25   ` guillermo.julian
2016-05-27 20:20     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).