When compiling at -Og:
In file included from
/builds/xen-project/people/andyhhp/xen/xen/include/asm/domain.h:4:0,
from /builds/xen-project/people/andyhhp/xen/xen/include/xen/domain.h:8,
from /builds/xen-project/people/andyhhp/xen/xen/include/xen/sched.h:11,
from /builds/xen-project/people/andyhhp/xen/xen/include/xen/ioreq.h:22,
from common.c:23:
common.c: In function '_shadow_prealloc':
/builds/xen-project/people/andyhhp/xen/xen/include/xen/mm.h:252:55: error: 't' may be used uninitialized in this function [-Werror=maybe-uninitialized]
return page != head->next ? pdx_to_page(page->list.prev) : NULL;
^
common.c:933:28: note: 't' was declared here
struct page_info *sp, *t;
^
I'm not certain the analysis is correct. 't' is a temporary variable, and is
clearly initialised before use in foreach_pinned_shadow(). Either way,
initialising it to NULL placates the compiler.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Tim Deegan <tim@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
---
xen/arch/x86/mm/shadow/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index b99ca14e71..737e6b365a 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -931,7 +931,7 @@ static inline void trace_shadow_prealloc_unpin(struct domain *d, mfn_t smfn)
static void _shadow_prealloc(struct domain *d, unsigned int pages)
{
struct vcpu *v;
- struct page_info *sp, *t;
+ struct page_info *sp, *t = NULL;
mfn_t smfn;
int i;
--
2.11.0
In file included from
/builds/xen-project/people/andyhhp/xen/xen/include/asm/domain.h:4:0,
from /builds/xen-project/people/andyhhp/xen/xen/include/xen/domain.h:8,
from /builds/xen-project/people/andyhhp/xen/xen/include/xen/sched.h:11,
from /builds/xen-project/people/andyhhp/xen/xen/include/xen/ioreq.h:22,
from common.c:23:
common.c: In function '_shadow_prealloc':
/builds/xen-project/people/andyhhp/xen/xen/include/xen/mm.h:252:55: error: 't' may be used uninitialized in this function [-Werror=maybe-uninitialized]
return page != head->next ? pdx_to_page(page->list.prev) : NULL;
^
common.c:933:28: note: 't' was declared here
struct page_info *sp, *t;
^
I'm not certain the analysis is correct. 't' is a temporary variable, and is
clearly initialised before use in foreach_pinned_shadow(). Either way,
initialising it to NULL placates the compiler.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Tim Deegan <tim@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Wei Liu <wl@xen.org>
---
xen/arch/x86/mm/shadow/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index b99ca14e71..737e6b365a 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -931,7 +931,7 @@ static inline void trace_shadow_prealloc_unpin(struct domain *d, mfn_t smfn)
static void _shadow_prealloc(struct domain *d, unsigned int pages)
{
struct vcpu *v;
- struct page_info *sp, *t;
+ struct page_info *sp, *t = NULL;
mfn_t smfn;
int i;
--
2.11.0