Skip to contentSkip to conversation

x86/mm: Initialize ol1e in create_grant_pv_mapping() for older compilers

PATCH In review Boris Ostrovsky 2 participants 3 messages Sep 14, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/mm: Initialize ol1e in create_grant_pv_mapping() for older compilers

On gcc 4.4.4:

mm.c: In function ‘create_grant_pv_mapping’:
mm.c:3839: error: ‘ol1e.l1’ may be used uninitialized in this function

While ol1e would not be used uninitialized (because rc needs to be properly set) we have to accommodate these older compliers.

---
 xen/arch/x86/mm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/x86/mm.c +2 -1
index 5208e73..8fed981 100644
@@ -3836,7 +3836,8 @@ int create_grant_pv_mapping(uint64_t addr, unsigned long frame,
 {
     struct vcpu *curr = current;
     struct domain *currd = curr->domain;
-    l1_pgentry_t nl1e, ol1e, *pl1e;
+    l1_pgentry_t nl1e, *pl1e;
+    l1_pgentry_t ol1e = {0}; /* older compilers may reqiure initialization */
     struct page_info *page;
     mfn_t gl1mfn;
     int rc = GNTST_general_error;
Signature · 7 lines
1.8.3.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 14.09.17 at 16:59, <[email protected]> wrote:

On gcc 4.4.4:

mm.c: In function ‘create_grant_pv_mapping’:
mm.c:3839: error: ‘ol1e.l1’ may be used uninitialized in this function

While ol1e would not be used uninitialized (because rc needs to be properly set) we have to accommodate these older compliers.

Ah yes, that's a common issue with older gcc.

xen/arch/x86/mm.c int create_grant_pv_mapping(uint64_t addr, unsigned long frame, · line 3840

Quoted 9 lines
xen/arch/x86/mm.c +2 -1
@@ -3836,7 +3836,8 @@ int create_grant_pv_mapping(uint64_t addr, unsigned long frame,
 {
     struct vcpu *curr = current;
     struct domain *currd = curr->domain;
-    l1_pgentry_t nl1e, ol1e, *pl1e;
+    l1_pgentry_t nl1e, *pl1e;
+    l1_pgentry_t ol1e = {0}; /* older compilers may reqiure initialization */

Just { } please, and I don't see a need for the comment. Easily adjustable while committing, of course. And with that

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 21 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 14.09.17 at 16:59, <[email protected]> wrote:

On gcc 4.4.4:

mm.c: In function ‘create_grant_pv_mapping’:
mm.c:3839: error: ‘ol1e.l1’ may be used uninitialized in this function

While ol1e would not be used uninitialized (because rc needs to be properly set) we have to accommodate these older compliers.

Ah yes, that's a common issue with older gcc.

xen/arch/x86/mm.c int create_grant_pv_mapping(uint64_t addr, unsigned long frame, · line 3840

Quoted 9 lines
xen/arch/x86/mm.c +2 -1
@@ -3836,7 +3836,8 @@ int create_grant_pv_mapping(uint64_t addr, unsigned long frame,
 {
     struct vcpu *curr = current;
     struct domain *currd = curr->domain;
-    l1_pgentry_t nl1e, ol1e, *pl1e;
+    l1_pgentry_t nl1e, *pl1e;
+    l1_pgentry_t ol1e = {0}; /* older compilers may reqiure initialization */

Just { } please, and I don't see a need for the comment. Easily adjustable while committing, of course. And with that

Quoted 1 line

Sure. Thanks.

-boris

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel