* [PATCH] xen/grant: Mute gcc warning in steal_linear_address()
@ 2018-08-30 4:06 Zhenzhong Duan
2018-08-30 7:22 ` Wei Liu
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Zhenzhong Duan @ 2018-08-30 4:06 UTC (permalink / raw)
To: Xen-Devel; +Cc: andrew.cooper3, wei.liu2, jbeulich, Srinivas REDDY Eeda
Move reference of ol1e ahead or else we see below warning.
cc1: warnings being treated as errors
grant_table.c: In function 'replace_grant_pv_mapping':
grant_table.c:142: warning: 'ol1e.l1' may be used uninitialized in this function
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
---
xen/arch/x86/pv/grant_table.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/pv/grant_table.c b/xen/arch/x86/pv/grant_table.c
index 6b7d855..5180334 100644
--- a/xen/arch/x86/pv/grant_table.c
+++ b/xen/arch/x86/pv/grant_table.c
@@ -167,6 +167,9 @@ static bool steal_linear_address(unsigned long linear, l1_pgentry_t *out)
ol1e = *pl1e;
okay = UPDATE_ENTRY(l1, pl1e, ol1e, l1e_empty(), mfn_x(gl1mfn), curr, 0);
+ if ( okay )
+ *out = ol1e;
+
out_unlock:
page_unlock(page);
out_put:
@@ -174,9 +177,6 @@ static bool steal_linear_address(unsigned long linear, l1_pgentry_t *out)
out_unmap:
unmap_domain_page(pl1e);
- if ( okay )
- *out = ol1e;
-
out:
return okay;
}
--
1.7.3
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] xen/grant: Mute gcc warning in steal_linear_address()
2018-08-30 4:06 [PATCH] xen/grant: Mute gcc warning in steal_linear_address() Zhenzhong Duan
@ 2018-08-30 7:22 ` Wei Liu
2018-08-30 8:02 ` Andrew Cooper
2018-08-30 8:04 ` Jan Beulich
2 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2018-08-30 7:22 UTC (permalink / raw)
To: Zhenzhong Duan
Cc: andrew.cooper3, Srinivas REDDY Eeda, wei.liu2, jbeulich, Xen-Devel
On Wed, Aug 29, 2018 at 09:06:02PM -0700, Zhenzhong Duan wrote:
> Move reference of ol1e ahead or else we see below warning.
>
> cc1: warnings being treated as errors
> grant_table.c: In function 'replace_grant_pv_mapping':
> grant_table.c:142: warning: 'ol1e.l1' may be used uninitialized in this function
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
I don't think there is a bug in the code. The compiler isn't smart
enough to figure out ol1e won't be used when okay is false.
Wei.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xen/grant: Mute gcc warning in steal_linear_address()
2018-08-30 4:06 [PATCH] xen/grant: Mute gcc warning in steal_linear_address() Zhenzhong Duan
2018-08-30 7:22 ` Wei Liu
@ 2018-08-30 8:02 ` Andrew Cooper
2018-08-30 8:04 ` Jan Beulich
2 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2018-08-30 8:02 UTC (permalink / raw)
To: Zhenzhong Duan, Xen-Devel; +Cc: wei.liu2, jbeulich, Srinivas REDDY Eeda
On 30/08/18 05:06, Zhenzhong Duan wrote:
> Move reference of ol1e ahead or else we see below warning.
>
> cc1: warnings being treated as errors
> grant_table.c: In function 'replace_grant_pv_mapping':
> grant_table.c:142: warning: 'ol1e.l1' may be used uninitialized in this function
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
Which version of GCC? This is a compiler bug, and it would be useful to
highlight which version in the commit message.
The patch itself is fine.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xen/grant: Mute gcc warning in steal_linear_address()
2018-08-30 4:06 [PATCH] xen/grant: Mute gcc warning in steal_linear_address() Zhenzhong Duan
2018-08-30 7:22 ` Wei Liu
2018-08-30 8:02 ` Andrew Cooper
@ 2018-08-30 8:04 ` Jan Beulich
2018-08-30 8:10 ` Zhenzhong Duan
2 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2018-08-30 8:04 UTC (permalink / raw)
To: Zhenzhong Duan; +Cc: Andrew Cooper, Srinivas REDDY Eeda, Wei Liu, Xen-Devel
>>> On 30.08.18 at 06:06, <zhenzhong.duan@oracle.com> wrote:
> Move reference of ol1e ahead or else we see below warning.
>
> cc1: warnings being treated as errors
> grant_table.c: In function 'replace_grant_pv_mapping':
> grant_table.c:142: warning: 'ol1e.l1' may be used uninitialized in this
> function
>
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
I'm fine with the change, but going forward please be more specific
with your descriptions: Whether or not warnings get emitted for a
certain piece of code often highly depends on compiler version. Let
us know which version you've run this into with. For the record, I'm
building on a wide range of gcc versions every once in a while, and
I've not come across this warning so far (or else I would have sent
a patch). The really old versions (4.1.x for example) can't really be
used anymore for certain other reasons anyway, and I think it's
about time we at least raise the bar a little (also for binutils, which
iirc was the actual problem with here, using a version matching in
original release time with gcc 4.1.x).
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] xen/grant: Mute gcc warning in steal_linear_address()
2018-08-30 8:04 ` Jan Beulich
@ 2018-08-30 8:10 ` Zhenzhong Duan
0 siblings, 0 replies; 5+ messages in thread
From: Zhenzhong Duan @ 2018-08-30 8:10 UTC (permalink / raw)
To: Jan Beulich; +Cc: Andrew Cooper, Srinivas REDDY Eeda, Wei Liu, Xen-Devel
在 2018/8/30 16:04, Jan Beulich 写道:
>>>> On 30.08.18 at 06:06, <zhenzhong.duan@oracle.com> wrote:
>> Move reference of ol1e ahead or else we see below warning.
>>
>> cc1: warnings being treated as errors
>> grant_table.c: In function 'replace_grant_pv_mapping':
>> grant_table.c:142: warning: 'ol1e.l1' may be used uninitialized in this
>> function
>>
>> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@oracle.com>
>
> I'm fine with the change, but going forward please be more specific
> with your descriptions: Whether or not warnings get emitted for a
> certain piece of code often highly depends on compiler version. Let
> us know which version you've run this into with. For the record, I'm
> building on a wide range of gcc versions every once in a while, and
> I've not come across this warning so far (or else I would have sent
> a patch). The really old versions (4.1.x for example) can't really be
> used anymore for certain other reasons anyway, and I think it's
> about time we at least raise the bar a little (also for binutils, which
> iirc was the actual problem with here, using a version matching in
> original release time with gcc 4.1.x).
gcc version 4.1.2 20080704 (Red Hat 4.1.2-55)
Thanks
Zhenzhong
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-30 8:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-30 4:06 [PATCH] xen/grant: Mute gcc warning in steal_linear_address() Zhenzhong Duan
2018-08-30 7:22 ` Wei Liu
2018-08-30 8:02 ` Andrew Cooper
2018-08-30 8:04 ` Jan Beulich
2018-08-30 8:10 ` Zhenzhong Duan
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.