Skip to contentSkip to conversation

mm,memory_hotplug: set failure reason in offline_pages()

PATCH Superseded Dan Carpenter 2 participants 3 messages Jun 25, 2025

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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")
---
 mm/memory_hotplug.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
mm/memory_hotplug.c +3 -1
index 4d864b4fb891..e954f81b55a0 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 = "nr_pages more than present_pages";
 			goto failed_removal_isolated;
+		}
 	}
 
 	ret = memory_notify(MEM_GOING_OFFLINE, &mem_arg);
Acked-by on v1 1/1
#1 lore raw
Quoted 14 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")
---
  mm/memory_hotplug.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
mm/memory_hotplug.c +0 -0
index 4d864b4fb891..e954f81b55a0 100644

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

Quoted 6 lines
mm/memory_hotplug.c +2 -1
@@ -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 = "nr_pages more than present_pages";

"node notifier failure"

With that

(likely should be squashed because the commit it might not be stable yet)

Signature · 3 lines
Cheers,

David / dhildenb
#2 lore raw
Quoted 24 lines · David Hildenbrand
Quoted 14 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")
---
  mm/memory_hotplug.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
mm/memory_hotplug.c +0 -0
index 4d864b4fb891..e954f81b55a0 100644

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

Quoted 6 lines
mm/memory_hotplug.c +2 -1
@@ -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 = "nr_pages more than present_pages";

"node notifier failure"

Quoted 5 lines

With that

(likely should be squashed because the commit it might not be stable yet)

Oh, yeah. I misread the code. Thanks. I resent now.

But, ugh, I forgot to add your Acked-by... But this is likely going to be squashed as you say so hopefully that's fine.

regards,
dan carpenter