xen/grant: Mute gcc warning in steal_linear_address()
PATCH 1/1 xen/grant: Mute gcc warning in steal_linear_address()
Move reference of ol1e ahead or else we see below warning.
cc1: warnings being treated as errorsgrant_table.c: In function 'replace_grant_pv_mapping':
grant_table.c:142: warning: 'ol1e.l1' may be used uninitialized in this function
--- xen/arch/x86/pv/grant_table.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
xen/arch/x86/pv/grant_table.c +3 -3
@@ -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; }
Signature · 6 lines
1.7.3 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Zhenzhong Duan
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 functionSigned-off-by Zhenzhong Duan <[email protected]>
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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 7 lines · Zhenzhong Duan
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 functionSigned-off-by Zhenzhong Duan <[email protected]>
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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 30.08.18 at 06:06, <[email protected]> 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 functionSigned-off-by Zhenzhong Duan <[email protected]>
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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 10 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 30.08.18 at 06:06, <[email protected]> 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 functionSigned-off-by Zhenzhong Duan <[email protected]>
Quoted 11 lines
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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel