From: zhongjiang <zhongjiang@huawei.com>
To: akpm@linux-foundation.org, toshi.kani@hpe.com
Cc: vbabka@suse.cz, mgorman@techsingularity.net, linux-mm@kvack.org
Subject: [PATCH] mm: fix a overflow in test_pages_in_a_zone()
Date: Tue, 7 Feb 2017 19:34:59 +0800 [thread overview]
Message-ID: <1486467299-22648-1-git-send-email-zhongjiang@huawei.com> (raw)
From: zhong jiang <zhongjiang@huawei.com>
when the mailline introduce the commit a96dfddbcc04
("base/memory, hotplug: fix a kernel oops in show_valid_zones()"),
it obtains the valid start and end pfn from the given pfn range.
The valid start pfn can fix the actual issue, but it introduce
another issue. The valid end pfn will may exceed the given end_pfn.
Ahthough the incorrect overflow will not result in actual problem
at present, but I think it need to be fixed.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
mm/memory_hotplug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index b8c11e0..f611584 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1521,7 +1521,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;
--
1.8.3.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2017-02-07 11:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-07 11:34 zhongjiang [this message]
2017-02-07 17:35 ` Kani, Toshimitsu
2017-02-08 6:12 ` zhong jiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1486467299-22648-1-git-send-email-zhongjiang@huawei.com \
--to=zhongjiang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=toshi.kani@hpe.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox