[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] libxc/arm: initialise p2m_size to make gcc happy



Hi,

On 03/14/2018 12:32 PM, Wei Liu wrote:
Gcc with -O3 failed to spot the loop to initialise p2m_size runs at
least once.

Aside, Andrew's comment the patch looks okay. But I am wondering why we need to allocate p2m_host for Arm?

From a quick look I have seen no real user except xc_dom_update_guest_p2m that can cope with p2m_host = NULL.

Cheers,


Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
  tools/libxc/xc_dom_arm.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/libxc/xc_dom_arm.c b/tools/libxc/xc_dom_arm.c
index 5b9eca6087..97d08f055a 100644
--- a/tools/libxc/xc_dom_arm.c
+++ b/tools/libxc/xc_dom_arm.c
@@ -395,7 +395,7 @@ static int meminit(struct xc_dom_image *dom)
      const uint64_t modsize = dtb_size + ramdisk_size;
      const uint64_t ram128mb = bankbase[0] + (128<<20);
- xen_pfn_t p2m_size;
+    xen_pfn_t p2m_size = 0; /* make gcc -O3 happy */
      uint64_t bank0end;
assert(dom->rambase_pfn << XC_PAGE_SHIFT == bankbase[0]);
@@ -438,6 +438,7 @@ static int meminit(struct xc_dom_image *dom)
assert(dom->rambank_size[0] != 0);
      assert(ramsize == 0); /* Too much RAM is rejected above */
+    assert(p2m_size != 0);
dom->p2m_size = p2m_size;
      dom->p2m_host = xc_dom_malloc(dom, sizeof(xen_pfn_t) * p2m_size);


--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.