[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181101095844.24462-4-mathieu.desnoyers@efficios.com>
Date: Thu, 1 Nov 2018 10:58:31 +0100
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Peter Zijlstra <peterz@...radead.org>,
"Paul E . McKenney" <paulmck@...ux.vnet.ibm.com>,
Boqun Feng <boqun.feng@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
Andy Lutomirski <luto@...capital.net>,
Dave Watson <davejwatson@...com>, Paul Turner <pjt@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Russell King <linux@....linux.org.uk>,
Ingo Molnar <mingo@...hat.com>,
"H . Peter Anvin" <hpa@...or.com>,
Andi Kleen <andi@...stfloor.org>, Chris Lameter <cl@...ux.com>,
Ben Maurer <bmaurer@...com>,
Steven Rostedt <rostedt@...dmis.org>,
Josh Triplett <josh@...htriplett.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
Michael Kerrisk <mtk.manpages@...il.com>,
Joel Fernandes <joelaf@...gle.com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Matthew Wilcox <mawilcox@...rosoft.com>
Subject: [RFC PATCH for 4.21 03/16] mm: Replace BUG_ON() by WARN_ON() in vm_unmap_ram()
It is encouraged to warn and return rather than use BUG_ON() when
the condition can be recovered from in ways that are more graceful than
halting the whole system.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Suggested-by: Steven Rostedt <rostedt@...dmis.org>
CC: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
CC: Matthew Wilcox <mawilcox@...rosoft.com>
CC: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
CC: Peter Zijlstra <peterz@...radead.org>
CC: Paul Turner <pjt@...gle.com>
CC: Thomas Gleixner <tglx@...utronix.de>
CC: Andy Lutomirski <luto@...capital.net>
CC: Andi Kleen <andi@...stfloor.org>
CC: Dave Watson <davejwatson@...com>
CC: Chris Lameter <cl@...ux.com>
CC: Ingo Molnar <mingo@...hat.com>
CC: "H. Peter Anvin" <hpa@...or.com>
CC: Ben Maurer <bmaurer@...com>
CC: Steven Rostedt <rostedt@...dmis.org>
CC: Josh Triplett <josh@...htriplett.org>
CC: Linus Torvalds <torvalds@...ux-foundation.org>
CC: Andrew Morton <akpm@...ux-foundation.org>
CC: Russell King <linux@....linux.org.uk>
CC: Catalin Marinas <catalin.marinas@....com>
CC: Will Deacon <will.deacon@....com>
CC: Michael Kerrisk <mtk.manpages@...il.com>
CC: Boqun Feng <boqun.feng@...il.com>
---
mm/vmalloc.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index a728fc492557..a236bac872f0 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1123,10 +1123,11 @@ void vm_unmap_ram(const void *mem, unsigned int count)
struct vmap_area *va;
might_sleep();
- BUG_ON(!addr);
- BUG_ON(addr < VMALLOC_START);
- BUG_ON(addr > VMALLOC_END);
- BUG_ON(!PAGE_ALIGNED(addr));
+ if (WARN_ON(!addr) ||
+ WARN_ON(addr < VMALLOC_START) ||
+ WARN_ON(addr > VMALLOC_END) ||
+ WARN_ON(!PAGE_ALIGNED(addr)))
+ return;
if (likely(count <= VMAP_MAX_ALLOC)) {
debug_check_no_locks_freed(mem, size);
@@ -1135,7 +1136,8 @@ void vm_unmap_ram(const void *mem, unsigned int count)
}
va = find_vmap_area(addr);
- BUG_ON(!va);
+ if (WARN_ON(!va))
+ return;
debug_check_no_locks_freed((void *)va->va_start,
(va->va_end - va->va_start));
free_unmap_vmap_area(va);
--
2.11.0
Powered by blists - more mailing lists