The patch titled Subject: mm/memory_hotplug: fix error return code in add_memory_resource() has been added to the -mm mm-unstable branch. Its filename is mm-memory_hotplug-embed-vmem_altmap-details-in-memory-block-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-memory_hotplug-embed-vmem_altmap-details-in-memory-block-fix.patch This patch will later appear in the mm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Yang Yingliang <yangyingliang@xxxxxxxxxx> Subject: mm/memory_hotplug: fix error return code in add_memory_resource() Date: Wed, 9 Aug 2023 16:15:52 +0800 Set error return code to -ENOMEM, when kmalloc() fails. Link: https://lkml.kernel.org/r/20230809081552.1351184-1-yangyingliang@xxxxxxxxxx Fixes: ad3232df3e41 ("mm/memory_hotplug: embed vmem_altmap details in memory block") Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx> Cc: David Hildenbrand <david@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxx> Cc: Oscar Salvador <osalvador@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory_hotplug.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/memory_hotplug.c~mm-memory_hotplug-embed-vmem_altmap-details-in-memory-block-fix +++ a/mm/memory_hotplug.c @@ -1440,8 +1440,10 @@ int __ref add_memory_resource(int nid, s if (mhp_supports_memmap_on_memory(size)) { mhp_altmap.free = memory_block_memmap_on_memory_pages(); params.altmap = kmalloc(sizeof(struct vmem_altmap), GFP_KERNEL); - if (!params.altmap) + if (!params.altmap) { + ret = -ENOMEM; goto error; + } memcpy(params.altmap, &mhp_altmap, sizeof(mhp_altmap)); } _ Patches currently in -mm which might be from yangyingliang@xxxxxxxxxx are mm-memory_hotplug-embed-vmem_altmap-details-in-memory-block-fix.patch