Skip to contentSkip to conversation

mm: fix overflow in find_zone_movable_pfns_for_nodes()

PATCH In review Xishi Qiu 4 participants 4 messages Sep 30, 2015 – Oct 1, 2015

Subsystems (2)
lore
Share & tools
lore

Xishi Qiu

author
#0 lore raw

PATCH 1/1 mm: fix overflow in find_zone_movable_pfns_for_nodes()

If user set "movablecore=xx" to a large number, corepages will overflow, this patch fix the problem.

---
 mm/page_alloc.c | 1 +
 1 file changed, 1 insertion(+)
mm/page_alloc.c +1 -0
index 48aaf7b..af3c9bd 100644
@@ -5668,6 +5668,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
 		 */
 		required_movablecore =
 			roundup(required_movablecore, MAX_ORDER_NR_PAGES);
+		required_movablecore = min(totalpages, required_movablecore);
 		corepages = totalpages - required_movablecore;
 
 		required_kernelcore = max(required_kernelcore, corepages);
Signature · 1 line
2.0.0
#1 lore raw

Seems OK to me.

Thanks.

Quoted 20 lines · Xishi Qiu

If user set "movablecore=xx" to a large number, corepages will overflow, this patch fix the problem.

---
  mm/page_alloc.c | 1 +
  1 file changed, 1 insertion(+)
mm/page_alloc.c +1 -0
index 48aaf7b..af3c9bd 100644
@@ -5668,6 +5668,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
  		 */
  		required_movablecore =
  			roundup(required_movablecore, MAX_ORDER_NR_PAGES);
+		required_movablecore = min(totalpages, required_movablecore);
  		corepages = totalpages - required_movablecore;
 
  		required_kernelcore = max(required_kernelcore, corepages);
Acked-by on v1 1/1
#2 lore raw
In reply to Xishi Qiu
Quoted 4 lines · Xishi Qiu

If user set "movablecore=xx" to a large number, corepages will overflow, this patch fix the problem.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

Reviewed-by on v1 1/1
#3 lore raw
In reply to Xishi Qiu
Quoted 5 lines · On Wed, 30 Sep 2015 17:33:42 +0800 Xishi Qiu <[email protected]> wrote:

If user set "movablecore=xx" to a large number, corepages will overflow, this patch fix the problem.

---

Looks good to me.

Thanks,
Yasuaki Ishimatsu

Quoted 24 lines
 mm/page_alloc.c | 1 +
 1 file changed, 1 insertion(+)
mm/page_alloc.c +1 -0
index 48aaf7b..af3c9bd 100644
@@ -5668,6 +5668,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
 		 */
 		required_movablecore =
 			roundup(required_movablecore, MAX_ORDER_NR_PAGES);
+		required_movablecore = min(totalpages, required_movablecore);
 		corepages = totalpages - required_movablecore;
 
 		required_kernelcore = max(required_kernelcore, corepages);
Signature · 8 lines
2.0.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>