Skip to contentSkip to conversation

mm-fix-overflow-in-vm_map_ram.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jun 6, 2016

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm: fix overflow in vm_map_ram()
has been removed from the -mm tree. Its filename was
mm-fix-overflow-in-vm_map_ram.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Guillermo Julián Moreno <[email protected]>
Subject: mm: fix overflow in vm_map_ram()

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.

---

 mm/vmalloc.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
mm/vmalloc.c renamed from mm/vmalloc.c~mm-fix-overflow-in-vm_map_ram +5 -4
diff -puN mm/vmalloc.c~mm-fix-overflow-in-vm_map_ram mm/vmalloc.c
@@ -1105,7 +1105,7 @@ EXPORT_SYMBOL_GPL(vm_unmap_aliases);
  */
 void vm_unmap_ram(const void *mem, unsigned int count)
 {
-	unsigned long size = count << PAGE_SHIFT;
+	unsigned long size = (unsigned long)count << PAGE_SHIFT;
 	unsigned long addr = (unsigned long)mem;
 
 	BUG_ON(!addr);
@@ -1140,7 +1140,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;
 
@@ -1574,14 +1574,15 @@ void *vmap(struct page **pages, unsigned
 		unsigned long flags, pgprot_t prot)
 {
 	struct vm_struct *area;
+	unsigned long size;		/* In bytes */
 
 	might_sleep();
 
 	if (count > totalram_pages)
 		return NULL;
 
-	area = get_vm_area_caller((count << PAGE_SHIFT), flags,
-					__builtin_return_address(0));
+	size = (unsigned long)count << PAGE_SHIFT;
+	area = get_vm_area_caller(size, flags, __builtin_return_address(0));
 	if (!area)
 		return NULL;
 

_

Patches currently in -mm which might be from [email protected] are

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html