From ba0c444153889a9b672974d85a4a57a8eeb49fe3 Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Tue, 31 Mar 2015 11:16:40 -0700 Subject: Drivers: hv: hv_balloon: correctly handle val.freeram Signed-off-by: Vitaly Kuznetsov Reviewed-by: Laszlo Ersek Signed-off-by: K. Y. Srinivasan Signed-off-by: Greg Kroah-Hartman --- drivers/hv/hv_balloon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/hv') diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 74312c88534a..4052ad8255fa 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -1155,7 +1155,7 @@ static void balloon_up(struct work_struct *dummy) floor = compute_balloon_floor(); /* Refuse to balloon below the floor, keep the 2M granularity. */ - if (val.freeram - num_pages < floor) { + if (val.freeram < num_pages || val.freeram - num_pages < floor) { num_pages = val.freeram > floor ? (val.freeram - floor) : 0; num_pages -= num_pages % PAGES_IN_2M; } -- cgit v1.2.2