diff mbox

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

Message ID 1505401192-4663-1-git-send-email-boris.ostrovsky@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boris Ostrovsky Sept. 14, 2017, 2:59 p.m. UTC
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.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
---
 xen/arch/x86/mm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jan Beulich Sept. 14, 2017, 3:11 p.m. UTC | #1
>>> On 14.09.17 at 16:59, <boris.ostrovsky@oracle.com> 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.

> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -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
Reviewed-by: Jan Beulich <jbeulich@suse.com>

Jan
Boris Ostrovsky Sept. 14, 2017, 3:12 p.m. UTC | #2
On 09/14/2017 11:11 AM, Jan Beulich wrote:
>>>> On 14.09.17 at 16:59, <boris.ostrovsky@oracle.com> 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.
>
>> --- a/xen/arch/x86/mm.c
>> +++ b/xen/arch/x86/mm.c
>> @@ -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
> Reviewed-by: Jan Beulich <jbeulich@suse.com>

Sure. Thanks.

-boris
diff mbox

Patch

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 5208e73..8fed981 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -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;