Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mm/sparse: more checks on mem_section number

__section_nr() was implemented to retrieve the corresponding memory
section number according to its descriptor. It's possible that the
specified memory section descriptor doesn't exist in the global array. So
add more checking on that and report an error for a wrong case.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Gavin Shan and committed by
Linus Torvalds
db36a461 5b760e64

+2
+2
mm/sparse.c
··· 130 130 break; 131 131 } 132 132 133 + VM_BUG_ON(root_nr == NR_SECTION_ROOTS); 134 + 133 135 return (root_nr * SECTIONS_PER_ROOT) + (ms - root); 134 136 } 135 137