Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1317564

[PATCH 2/2 v2] make apply_to_page_range() more robust.

From <mika.penttila@nextfour.com>
Newsgroups linux.kernel
Subject [PATCH 2/2 v2] make apply_to_page_range() more robust.
Date 2016-01-26 07:40 +0100
Message-ID <qV5se-86A-11@gated-at.bofh.it> (permalink)
References <qV5se-86A-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Mika Penttilä <mika.penttila@nextfour.com>

Now the arm/arm64 don't trigger this BUG_ON() any more,
but WARN_ON() is here enough to catch buggy callers
but still let potential other !size callers pass with warning.

Signed-off-by: Mika Penttilä mika.penttila@nextfour.com
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Acked-by: David Rientjes <rientjes@google.com>

---
 mm/memory.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/memory.c b/mm/memory.c
index 30991f8..9178ee6 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1871,7 +1871,9 @@ int apply_to_page_range(struct mm_struct *mm, unsigned long addr,
 	unsigned long end = addr + size;
 	int err;
 
-	BUG_ON(addr >= end);
+	if (WARN_ON(addr >= end))
+		return -EINVAL;
+
 	pgd = pgd_offset(mm, addr);
 	do {
 		next = pgd_addr_end(addr, end);
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2 v2] set_memory_xx fixes <mika.penttila@nextfour.com> - 2016-01-26 07:40 +0100
  [PATCH 1/2 v2] arm, arm64: change_memory_common with numpages == 0 should be no-op. <mika.penttila@nextfour.com> - 2016-01-26 07:40 +0100
  [PATCH 2/2 v2] make apply_to_page_range() more robust. <mika.penttila@nextfour.com> - 2016-01-26 07:40 +0100
  Re: [PATCH 0/2 v2] set_memory_xx fixes Russell King - ARM Linux <linux@arm.linux.org.uk> - 2016-01-26 15:40 +0100

csiph-web