diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-06-23 10:32:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-06-23 10:32:24 -0400 |
commit | 0971e82ea34c5e01cd3e68d231caa81780e8cafb (patch) | |
tree | 7e19b4cf16b7f448de54b10d581ac958906da6e7 /include/linux | |
parent | b67eeff799489b2d5350130828d1793ff6c74cfb (diff) | |
parent | 8043832e2a123fd9372007a29192f2f3ba328cd6 (diff) |
Merge tag 'fixes-2024-06-23' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock
Pull memblock fix from Mike Rapoport:
"Fix fragility in checks for unset node ID.
Use numa_valid_node() function to verify that nid is a valid node
ID instead of inconsistent comparisons with either NUMA_NO_NODE or
MAX_NUMNODES"
* tag 'fixes-2024-06-23' of git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock:
memblock: use numa_valid_node() helper to check for invalid node ID
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/numa.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/numa.h b/include/linux/numa.h index 1d43371fafd2..eb19503604fe 100644 --- a/include/linux/numa.h +++ b/include/linux/numa.h @@ -15,6 +15,11 @@ #define NUMA_NO_NODE (-1) #define NUMA_NO_MEMBLK (-1) +static inline bool numa_valid_node(int nid) +{ + return nid >= 0 && nid < MAX_NUMNODES; +} + /* optionally keep NUMA memory info available post init */ #ifdef CONFIG_NUMA_KEEP_MEMINFO #define __initdata_or_meminfo |