Skip to contentSkip to conversation

mm,memory_hotplug: set failure reason in offline_pages()

PATCH In review Dan Carpenter 3 participants 3 messages Jun 25, 2025

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

PATCH v2 1/1 mm,memory_hotplug: set failure reason in offline_pages()

The "reason" variable is uninitialized on this error path. It's supposed to explain why the function failed.

Fixes e4e2806b639c ("mm,memory_hotplug: implement numa node notifier")

---
v2: I misunderstood the reason why the function was failing. Use the
correct reason.

 mm/memory_hotplug.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/memory_hotplug.c +3 -1
index 4d864b4fb891..e4009a44f883 100644
@@ -1977,8 +1977,10 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages,
 		node_arg.nid = node;
 		ret = node_notify(NODE_REMOVING_LAST_MEMORY, &node_arg);
 		ret = notifier_to_errno(ret);
-		if (ret)
+		if (ret) {
+			reason = "node notifier failure";
 			goto failed_removal_isolated;
+		}
 	}
 
 	ret = memory_notify(MEM_GOING_OFFLINE, &mem_arg);
Signature · 1 line
2.47.2
Acked-by on v2 1/1
#1 lore raw
Quoted 18 lines · Dan Carpenter

The "reason" variable is uninitialized on this error path. It's supposed to explain why the function failed.

Fixes e4e2806b639c ("mm,memory_hotplug: implement numa node notifier")

---
v2: I misunderstood the reason why the function was failing. Use the
correct reason.

  mm/memory_hotplug.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
mm/memory_hotplug.c +0 -0
index 4d864b4fb891..e4009a44f883 100644
@@ -1977,8 +1977,10 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages,
  		node_arg.nid = node;

mm/memory_hotplug.c int offline_pages(unsigned long start_pfn, unsigned long nr_pages, · line 1986

Quoted 10 lines
mm/memory_hotplug.c +3 -1
  		ret = node_notify(NODE_REMOVING_LAST_MEMORY, &node_arg);
  		ret = notifier_to_errno(ret);
-		if (ret)
+		if (ret) {
+			reason = "node notifier failure";
  			goto failed_removal_isolated;
+		}
  	}
 
  	ret = memory_notify(MEM_GOING_OFFLINE, &mem_arg);

Again, likely to be squashed :)

Signature · 3 lines
Cheers,

David / dhildenb
maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 5 lines · Dan Carpenter

The "reason" variable is uninitialized on this error path. It's supposed to explain why the function failed.

Fixes e4e2806b639c ("mm,memory_hotplug: implement numa node notifier")

Thanks Dan!

Although.. we might be in time to squash it, right?

Signature · 2 lines
Oscar Salvador
SUSE Labs