Skip to content

Commit d538c16

Browse files
RichardWeiYangtorvalds
authored andcommitted
mm/sparse.c: check __highest_present_section_nr only for a present section
When searching a present section, there are two boundaries: * __highest_present_section_nr * NR_MEM_SECTIONS And it is known, __highest_present_section_nr is a more strict boundary than NR_MEM_SECTIONS. This means it would be necessary to check __highest_present_section_nr only. Link: http://lkml.kernel.org/r/20180326081956.75275-2-richard.weiyang@gmail.com Signed-off-by: Wei Yang <richard.weiyang@gmail.com> Acked-by: David Rientjes <rientjes@google.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Dave Hansen <dave.hansen@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6882728 commit d538c16

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

‎mm/sparse.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,13 @@ static inline int next_present_section_nr(int section_nr)
190190
section_nr++;
191191
if (present_section_nr(section_nr))
192192
return section_nr;
193-
} while ((section_nr < NR_MEM_SECTIONS) &&
194-
(section_nr <= __highest_present_section_nr));
193+
} while ((section_nr <= __highest_present_section_nr));
195194

196195
return -1;
197196
}
198197
#define for_each_present_section_nr(start, section_nr) \
199198
for (section_nr = next_present_section_nr(start-1); \
200199
((section_nr >= 0) && \
201-
(section_nr < NR_MEM_SECTIONS) && \
202200
(section_nr <= __highest_present_section_nr)); \
203201
section_nr = next_present_section_nr(section_nr))
204202

0 commit comments

Comments
 (0)