[lvc-project] [PATCH] mm/memory_hotplug: prevent accessing by index=-1

Oscar Salvador osalvador at suse.com
Mon Jun 3 20:53:55 MSK 2024


On Mon, Jun 03, 2024 at 06:07:39PM +0200, David Hildenbrand wrote:
> pgdat is never dereferenced when "nid == NUMA_NO_NODE".

Right.

> NODE_DATA is defined as
> 
> arch/arm64/include/asm/mmzone.h:#define NODE_DATA(nid)          (node_data[(nid)])
> arch/loongarch/include/asm/mmzone.h:#define NODE_DATA(nid)      (node_data[(nid)])
> arch/mips/include/asm/mach-ip27/mmzone.h:#define NODE_DATA(n)           (&__node_data[(n)]->pglist)

All look fine, but mips.

Is it not dangerous to try to derefence &__node_data[-1]->pglist?


-- 
Oscar Salvador
SUSE Labs



More information about the lvc-project mailing list