Skip to contentSkip to conversation

mm-vmalloc-replace-bug_on-to-a-simple-if-statement.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Feb 10, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/vmalloc: replace BUG_ON with a simple if statement
has been removed from the -mm tree. Its filename was
mm-vmalloc-replace-bug_on-to-a-simple-if-statement.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Hyunmin Lee <[email protected]>
Subject: mm/vmalloc: replace BUG_ON with a simple if statement
Date: Wed, 1 Feb 2023 20:51:42 +0900

As per the coding standards, in the event of an abnormal condition that should not occur under normal circumstances, the kernel should attempt recovery and proceed with execution, rather than halting the machine.

Specifically, in the alloc_vmap_area() function, use a simple if() instead of using BUG_ON() halting the machine.

---

 mm/vmalloc.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
mm/vmalloc.c renamed from mm/vmalloc.c~mm-vmalloc-replace-bug_on-to-a-simple-if-statement +2 -3
@@ -1586,9 +1586,8 @@ static struct vmap_area *alloc_vmap_area
 	int purged = 0;
 	int ret;
 
-	BUG_ON(!size);
-	BUG_ON(offset_in_page(size));
-	BUG_ON(!is_power_of_2(align));
+	if (unlikely(!size || offset_in_page(size) || !is_power_of_2(align)))
+		return ERR_PTR(-EINVAL);
 
 	if (unlikely(!vmap_initialized))
 		return ERR_PTR(-EBUSY);

_

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