[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 03/10] tools/libxg: Fix uninitialised variable in meminit()
Hi Andrew, On 12/02/2021 15:39, Andrew Cooper wrote: Various version of gcc, when compiling with -Og, complain: xg_dom_arm.c: In function 'meminit': xg_dom_arm.c:420:19: error: 'p2m_size' may be used uninitialized in this function [-Werror=maybe-uninitialized] 420 | dom->p2m_size = p2m_size; | ~~~~~~~~~~~~~~^~~~~~~~~~ Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> This was reported nearly 3 years ago (see [1]) and it is pretty sad this was never merged :(. --- CC: Ian Jackson <iwj@xxxxxxxxxxxxxx> CC: Wei Liu <wl@xxxxxxx> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> CC: Julien Grall <julien@xxxxxxx> Julien/Stefano: I can't work out how this variable is supposed to work, and the fact that it isn't a straight accumulation across the RAM banks looks suspect. It looks buggy, but the P2M is never used on Arm. In fact, you sent a patch a year ago to drop it (see [2]). It would be nice to revive it. --- tools/libs/guest/xg_dom_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libs/guest/xg_dom_arm.c b/tools/libs/guest/xg_dom_arm.c index 94948d2b20..f1b8d06f75 100644 --- a/tools/libs/guest/xg_dom_arm.c +++ b/tools/libs/guest/xg_dom_arm.c @@ -373,7 +373,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; uint64_t bank0end;assert(dom->rambase_pfn << XC_PAGE_SHIFT == bankbase[0]); If your original series is too risky for 4.15, I would consider to remote p2m_size completely and always 0 dom->p2m_size. Cheers,[1] https://lore.kernel.org/xen-devel/20180314123203.30646-1-wei.liu2@xxxxxxxxxx/ [2] https://patchwork.kernel.org/project/xen-devel/patch/20191217201550.15864-3-andrew.cooper3@xxxxxxxxxx/ -- Julien Grall
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |