Skip to contentSkip to conversation

arch:arm:mm:Aligning the module end and Correction in

PATCH New Shailendra Verma 1 participant 1 message Nov 17, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arch:arm:mm:Aligning the module end and Correction in

From: Shailendra Verma <[email protected]>

The module end was not aligned as of module start and boundary check for module end is not proper.This out of bound value of module end can produce undesired results.

---
 linux-4.3-rc6/arch/arm/mm/pageattr.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
linux-4.3-rc6/arch/arm/mm/pageattr.c +5 -6
index cf30daf..17f103c 100644
@@ -43,16 +43,15 @@ static int change_memory_common(unsigned long addr, int numpages,
 	int ret;
 	struct page_change_data data;
 
-	if (!IS_ALIGNED(addr, PAGE_SIZE)) {
-		start &= PAGE_MASK;
-		end = start + size;
-		WARN_ON_ONCE(1);
-	}
+	if (WARN_ON_ONCE(!IS_ALIGNED(addr, PAGE_SIZE))) {
+		start &= PAGE_MASK;
+		end = PAGE_ALIGN(end);
+	}
 
 	if (start < MODULES_VADDR || start >= MODULES_END)
 		return -EINVAL;
 
-	if (end < MODULES_VADDR || start >= MODULES_END)
+	if (end < MODULES_VADDR || end >= MODULES_END)
 		return -EINVAL;
 
 	data.set_mask = set_mask;
Signature · 1 line
1.7.9.5