* [Qemu-devel] [PATCH] hw/openrisc/openrisc_sim: Avoid using uninitialised variable 'entry'
@ 2013-08-05 18:24 Peter Maydell
2013-08-06 1:24 ` Jia Liu
2013-08-20 13:00 ` Peter Maydell
0 siblings, 2 replies; 4+ messages in thread
From: Peter Maydell @ 2013-08-05 18:24 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Jia Liu, patches
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 <peter.maydell@linaro.org>
---
hw/openrisc/openrisc_sim.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
index a08f27c..4595fa9 100644
--- a/hw/openrisc/openrisc_sim.c
+++ b/hw/openrisc/openrisc_sim.c
@@ -86,9 +86,9 @@ 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.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/openrisc/openrisc_sim: Avoid using uninitialised variable 'entry'
2013-08-05 18:24 [Qemu-devel] [PATCH] hw/openrisc/openrisc_sim: Avoid using uninitialised variable 'entry' Peter Maydell
@ 2013-08-06 1:24 ` Jia Liu
2013-08-20 13:00 ` Peter Maydell
1 sibling, 0 replies; 4+ messages in thread
From: Jia Liu @ 2013-08-06 1:24 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-trivial, qemu-devel@nongnu.org, patches
Hi Peter,
On Tue, Aug 6, 2013 at 2:24 AM, Peter Maydell <peter.maydell@linaro.org> wrote:
> 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 <peter.maydell@linaro.org>
> ---
> hw/openrisc/openrisc_sim.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
> index a08f27c..4595fa9 100644
> --- a/hw/openrisc/openrisc_sim.c
> +++ b/hw/openrisc/openrisc_sim.c
> @@ -86,9 +86,9 @@ 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)
Thank you for using clang test it.
Reviewed-by: Jia Liu <proljc@gmail.com>
> --
> 1.7.9.5
>
Regards,
Jia
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/openrisc/openrisc_sim: Avoid using uninitialised variable 'entry'
2013-08-05 18:24 [Qemu-devel] [PATCH] hw/openrisc/openrisc_sim: Avoid using uninitialised variable 'entry' Peter Maydell
2013-08-06 1:24 ` Jia Liu
@ 2013-08-20 13:00 ` Peter Maydell
2013-08-20 13:24 ` Jia Liu
1 sibling, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2013-08-20 13:00 UTC (permalink / raw)
To: QEMU Developers; +Cc: QEMU Trivial, Jia Liu, Patch Tracking
Ping for qemu-trivial now 1.7 is open.
thanks
-- PMM
On 5 August 2013 19:24, Peter Maydell <peter.maydell@linaro.org> wrote:
> 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 <peter.maydell@linaro.org>
> ---
> hw/openrisc/openrisc_sim.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
> index a08f27c..4595fa9 100644
> --- a/hw/openrisc/openrisc_sim.c
> +++ b/hw/openrisc/openrisc_sim.c
> @@ -86,9 +86,9 @@ 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.9.5
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/openrisc/openrisc_sim: Avoid using uninitialised variable 'entry'
2013-08-20 13:00 ` Peter Maydell
@ 2013-08-20 13:24 ` Jia Liu
0 siblings, 0 replies; 4+ messages in thread
From: Jia Liu @ 2013-08-20 13:24 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Trivial, QEMU Developers, Patch Tracking
Hi Peter,
On Tue, Aug 20, 2013 at 9:00 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Ping for qemu-trivial now 1.7 is open.
Thank you, I'll send a PULL very soon.
>
> thanks
> -- PMM
>
> On 5 August 2013 19:24, Peter Maydell <peter.maydell@linaro.org> wrote:
>> 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 <peter.maydell@linaro.org>
>> ---
>> hw/openrisc/openrisc_sim.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/hw/openrisc/openrisc_sim.c b/hw/openrisc/openrisc_sim.c
>> index a08f27c..4595fa9 100644
>> --- a/hw/openrisc/openrisc_sim.c
>> +++ b/hw/openrisc/openrisc_sim.c
>> @@ -86,9 +86,9 @@ 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.9.5
>>
>>
Regards,
Jia
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-08-20 13:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-05 18:24 [Qemu-devel] [PATCH] hw/openrisc/openrisc_sim: Avoid using uninitialised variable 'entry' Peter Maydell
2013-08-06 1:24 ` Jia Liu
2013-08-20 13:00 ` Peter Maydell
2013-08-20 13:24 ` Jia Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).