[linux-2.6.18-xen] balloon: don't BUG() when balloon is empty

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[linux-2.6.18-xen] balloon: don't BUG() when balloon is empty

patchbot
# HG changeset patch
# User Jan Beulich <[hidden email]>
# Date 1525335319 -7200
#      Thu May 03 10:15:19 2018 +0200
# Node ID f8a110b3f989066e9b987739323c427a030efd45
# Parent  0f354e1b83792d0cf6a91f638ac843b43ba48b4c
balloon: don't BUG() when balloon is empty

Signed-off-by: Jan Beulich <[hidden email]>
---


diff -r 0f354e1b8379 -r f8a110b3f989 drivers/xen/balloon/balloon.c
--- a/drivers/xen/balloon/balloon.c Thu May 03 10:12:14 2018 +0200
+++ b/drivers/xen/balloon/balloon.c Thu May 03 10:15:19 2018 +0200
@@ -254,13 +254,18 @@ static int increase_reservation(unsigned
 
  page = balloon_first_page();
  for (i = 0; i < nr_pages; i++) {
- BUG_ON(page == NULL);
- frame_list[i] = page_to_pfn(page);;
+ if (!page) {
+ if (i)
+ break;
+ rc = -ENXIO;
+ goto out;
+ }
+ frame_list[i] = page_to_pfn(page);
  page = balloon_next_page(page);
  }
 
  set_xen_guest_handle(reservation.extent_start, frame_list);
- reservation.nr_extents = nr_pages;
+ reservation.nr_extents = i;
  rc = HYPERVISOR_memory_op(XENMEM_populate_physmap, &reservation);
  if (rc < 0)
  goto out;

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog