Skip to contentSkip to conversation

mm/vmalloc: Use more common error handling code in pcpu_get_vm_areas()

PATCH Applied Markus Elfring 2 participants 2 messages Jun 16

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/vmalloc: Use more common error handling code in pcpu_get_vm_areas()

From: Markus Elfring <[email protected]>
Date: Tue, 16 Jun 2026 18:00:16 +0200

Use an existing label once more so that a bit of exception handling can be better reused at the end of this function implementation.

This issue was detected by using the Coccinelle software.

---
 mm/vmalloc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
mm/vmalloc.c +1 -3
index 1afca3568b9b..21a890586fef 100644
@@ -5198,9 +5198,7 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
 		kfree(vms[area]);
 	}
 	spin_unlock(&free_vmap_area_lock);
-	kfree(vas);
-	kfree(vms);
-	return NULL;
+	goto err_free2;
 }
 
 /**
Signature · 1 line
2.54.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 31 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 16 Jun 2026 18:00:16 +0200

Use an existing label once more so that a bit of exception handling can be better reused at the end of this function implementation.

This issue was detected by using the Coccinelle software.

---
 mm/vmalloc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
mm/vmalloc.c +1 -3
index 1afca3568b9b..21a890586fef 100644
@@ -5198,9 +5198,7 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
 		kfree(vms[area]);
 	}
 	spin_unlock(&free_vmap_area_lock);
-	kfree(vas);
-	kfree(vms);
-	return NULL;
+	goto err_free2;
 }
 
 /**
Signature · 1 line
2.54.0

More removing then adding!

--
Uladzislau Rezki