Hi Jan,
On 10/03/2021 10:13, Jan Beulich wrote:
Sadly I was wrong to suggest dropping vaddrs' initializer during review
of v2 of the patch introducing this code. gcc 4.3 can't cope.
What's the error? Are you sure this is not going to hiding a potential
miscompilation of the function?
Fixes: 52531c734ea1 ("xen/gnttab: Rework resource acquisition")
Signed-off-by: Jan Beulich <jbeul...@suse.com>
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -4026,7 +4026,7 @@ int gnttab_acquire_resource(
struct grant_table *gt = d->grant_table;
unsigned int i, final_frame;
mfn_t tmp;
- void **vaddrs;
+ void **vaddrs = NULL;
I am a bit nervous to inialize vaddrs to NULL for a few reasons:
1) It is not 100% obvious (e.g. it takes more than a second) that
vaddrs will always be initialized.
2) A compiler will not be able to help us if we are adding code
without initialized vaddrs.
It also feels wrong to me to try to write Xen in a way that will make a
10 years compiler happy...
If we still want to support them, then maybe a better approach would be
to turn off to turn off -Werror for some version of GCC. So we can
continue to benefit from the newer compiler diagnostics.
Cheers,
--
Julien Grall