diff options
author | zhong jiang <zhongjiang@huawei.com> | 2017-02-08 10:27:45 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2017-02-09 21:53:05 +1100 |
commit | 391d91cf117df2214f13ac122b46169a8f06895d (patch) | |
tree | 0197b5ad92d7d5ef6975d401847a1f506ba39bc3 /mm | |
parent | 4c94e4c0bd52f6c1692db859e641592e2cc9d2b8 (diff) |
mm/memory_hotplug.c: fix overflow in test_pages_in_a_zone()
When mainline introduced a96dfddbcc04 ("base/memory, hotplug: fix a kernel
oops in show_valid_zones()"), it obtained the valid start and end pfn from
the given pfn range. The valid start pfn can fix the actual issue, but it
introduced another issue. The valid end pfn will may exceed the given
end_pfn.
Although the incorrect overflow will not result in actual problem at
present, but I think it need to be fixed.
Fixes: a96dfddbcc04 ("base/memory, hotplug: fix a kernel oops in show_valid_zones()")
Link: http://lkml.kernel.org/r/1486467299-22648-1-git-send-email-zhongjiang@huawei.com
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Cc: Toshi Kani <toshi.kani@hpe.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory_hotplug.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 50b586cccb9d..41878b340271 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1526,7 +1526,7 @@ int test_pages_in_a_zone(unsigned long start_pfn, unsigned long end_pfn, if (zone) { *valid_start = start; - *valid_end = end; + *valid_end = min(end, end_pfn); return 1; } else { return 0; |