All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] xen/arm: fix build after 2e35cdf
@ 2019-06-19 21:24 Stefano Stabellini
  2019-06-19 21:40 ` Julien Grall
  0 siblings, 1 reply; 9+ messages in thread
From: Stefano Stabellini @ 2019-06-19 21:24 UTC (permalink / raw)
  To: xen-devel; +Cc: andrew.cooper3, julien.grall, sstabellini, Volodymyr_Babchuk

[-- Attachment #1: Type: text/plain, Size: 1899 bytes --]

Optee breaks the build with:

optee.c: In function ‘translate_noncontig.isra.4’:
optee.c:743:38: error: ‘xen_data’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
             xen_data->next_page_data = page_to_maddr(xen_pgs + 1);
                                      ^
optee.c:732:71: error: ‘guest_data’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
         page = get_domain_ram_page(gaddr_to_gfn(guest_data->pages_list[idx]));
                                                                       ^
optee.c:750:21: error: ‘guest_pg’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
             put_page(guest_pg);
                     ^
cc1: all warnings being treated as errors

Fix it by initializing xen_data, guest_data, guest_pg to NULL. Also set
xen_pgs to NULL for consistency.

Signed-off-by: Stefano Stabellini <stefanos@xilinx.com>

diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 28d34360fc..4825cc5410 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -663,7 +663,7 @@ static int translate_noncontig(struct optee_domain *ctx,
     unsigned int order;
     unsigned int idx = 0;
     gfn_t gfn;
-    struct page_info *guest_pg, *xen_pgs;
+    struct page_info *guest_pg = NULL, *xen_pgs = NULL;
     struct optee_shm_buf *optee_shm_buf;
     /*
      * This is memory layout for page list. Basically list consists of 4k pages,
@@ -675,7 +675,7 @@ static int translate_noncontig(struct optee_domain *ctx,
     struct {
         uint64_t pages_list[PAGELIST_ENTRIES_PER_PAGE];
         uint64_t next_page_data;
-    } *guest_data, *xen_data;
+    } *guest_data = NULL, *xen_data = NULL;
 
     /* Offset of user buffer withing OPTEE_MSG_NONCONTIG_PAGE_SIZE-sized page */
     offset = param->u.tmem.buf_ptr & (OPTEE_MSG_NONCONTIG_PAGE_SIZE - 1);

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-06-21  9:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-19 21:24 [Xen-devel] [PATCH] xen/arm: fix build after 2e35cdf Stefano Stabellini
2019-06-19 21:40 ` Julien Grall
2019-06-19 21:47   ` Stefano Stabellini
2019-06-19 21:54     ` Julien Grall
2019-06-19 22:04       ` Stefano Stabellini
2019-06-20 10:00         ` Julien Grall
2019-06-21  9:44           ` Jan Beulich
2019-06-20 11:05     ` Volodymyr Babchuk
2019-06-20 11:54       ` Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.