[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/3] hw/openrisc: Avoid using uninitialised variable
From: |
Jia Liu |
Subject: |
[Qemu-devel] [PULL 1/3] hw/openrisc: Avoid using uninitialised variable 'entry' |
Date: |
Wed, 21 Aug 2013 10:06:49 +0800 |
clang warns that cpu_openrisc_load_kernel() can use 'entry' uninitialized:
hw/openrisc/openrisc_sim.c:69:9: error: variable 'entry' is used uninitialized
whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized]
if (kernel_filename && !qtest_enabled()) {
^~~~~~~~~~~~~~~
hw/openrisc/openrisc_sim.c:91:19: note: uninitialized use occurs here
cpu->env.pc = entry;
^~~~~
Fix this by not attempting to change the CPU's starting PC unless
we actually loaded a kernel.
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Jia Liu <address@hidden>
---
hw/openrisc/openrisc_sim.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index a08f27c..28fa41d 100644
--- a/hw/openrisc/openrisc_sim.c
+++ b/hw/openrisc/openrisc_sim.c
@@ -86,9 +86,8 @@ static void cpu_openrisc_load_kernel(ram_addr_t ram_size,
kernel_filename);
exit(1);
}
+ cpu->env.pc = entry;
}
-
- cpu->env.pc = entry;
}
static void openrisc_sim_init(QEMUMachineInitArgs *args)
--
1.7.12.4 (Apple Git-37)