* [Qemu-devel] [PATCH] spapr: add missing break in h_get_cpu_characteristics()
@ 2018-02-01 19:47 Greg Kurz
2018-02-02 4:31 ` Suraj Jitindar Singh
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Greg Kurz @ 2018-02-01 19:47 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-ppc, David Gibson, Suraj Jitindar Singh,
Alexey Kardashevskiy
Detected by Coverity (CID 1385702). This fixes the recently added hypercall
to let guests properly apply Spectre and Meltdown workarounds.
Fixes: c59704b25473 "target/ppc/spapr: Add H-Call H_GET_CPU_CHARACTERISTICS"
Signed-off-by: Greg Kurz <groug@kaod.org>
---
hw/ppc/spapr_hcall.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 4d0e6eb0cf1d..596f58378a40 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1697,6 +1697,7 @@ static target_ulong h_get_cpu_characteristics(PowerPCCPU *cpu,
switch (safe_indirect_branch) {
case SPAPR_CAP_FIXED:
characteristics |= H_CPU_CHAR_BCCTRL_SERIALISED;
+ break;
default: /* broken */
assert(safe_indirect_branch == SPAPR_CAP_BROKEN);
break;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] spapr: add missing break in h_get_cpu_characteristics()
2018-02-01 19:47 [Qemu-devel] [PATCH] spapr: add missing break in h_get_cpu_characteristics() Greg Kurz
@ 2018-02-02 4:31 ` Suraj Jitindar Singh
2018-02-02 9:11 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
2018-02-08 23:28 ` [Qemu-devel] " David Gibson
2 siblings, 0 replies; 6+ messages in thread
From: Suraj Jitindar Singh @ 2018-02-02 4:31 UTC (permalink / raw)
To: Greg Kurz, qemu-devel; +Cc: qemu-ppc, David Gibson, Alexey Kardashevskiy
On Thu, 2018-02-01 at 20:47 +0100, Greg Kurz wrote:
> Detected by Coverity (CID 1385702). This fixes the recently added
> hypercall
> to let guests properly apply Spectre and Meltdown workarounds.
>
> Fixes: c59704b25473 "target/ppc/spapr: Add H-Call
> H_GET_CPU_CHARACTERISTICS"
> Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
> ---
> hw/ppc/spapr_hcall.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index 4d0e6eb0cf1d..596f58378a40 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -1697,6 +1697,7 @@ static target_ulong
> h_get_cpu_characteristics(PowerPCCPU *cpu,
> switch (safe_indirect_branch) {
> case SPAPR_CAP_FIXED:
> characteristics |= H_CPU_CHAR_BCCTRL_SERIALISED;
> + break;
> default: /* broken */
> assert(safe_indirect_branch == SPAPR_CAP_BROKEN);
> break;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr: add missing break in h_get_cpu_characteristics()
2018-02-01 19:47 [Qemu-devel] [PATCH] spapr: add missing break in h_get_cpu_characteristics() Greg Kurz
2018-02-02 4:31 ` Suraj Jitindar Singh
@ 2018-02-02 9:11 ` Daniel Henrique Barboza
2018-02-02 10:00 ` Greg Kurz
2018-02-08 23:28 ` [Qemu-devel] " David Gibson
2 siblings, 1 reply; 6+ messages in thread
From: Daniel Henrique Barboza @ 2018-02-02 9:11 UTC (permalink / raw)
To: Greg Kurz, qemu-devel; +Cc: qemu-ppc, Suraj Jitindar Singh, David Gibson
On 02/01/2018 05:47 PM, Greg Kurz wrote:
> Detected by Coverity (CID 1385702). This fixes the recently added hypercall
> to let guests properly apply Spectre and Meltdown workarounds.
Paolo Bonzini reported this error in a reply to the pull request that
added the patch:
"Re: [Qemu-ppc] [Qemu-devel] [PULL 12/12] target/ppc/spapr: Add H-Call
H_GET_CPU_CHARACTERISTICS
On 28/01/2018 22:28, David Gibson wrote:
> + switch (safe_indirect_branch) {
> + case SPAPR_CAP_FIXED:
> + characteristics |= H_CPU_CHAR_BCCTRL_SERIALISED;
Missing "break;" here.
Paolo
"
I think it is nice to mention in the commit msg that Paolo also detected
this same error,
specially given that his email was sent before this patch.
Thanks,
Daniel
>
> Fixes: c59704b25473 "target/ppc/spapr: Add H-Call H_GET_CPU_CHARACTERISTICS"
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> hw/ppc/spapr_hcall.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index 4d0e6eb0cf1d..596f58378a40 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -1697,6 +1697,7 @@ static target_ulong h_get_cpu_characteristics(PowerPCCPU *cpu,
> switch (safe_indirect_branch) {
> case SPAPR_CAP_FIXED:
> characteristics |= H_CPU_CHAR_BCCTRL_SERIALISED;
> + break;
> default: /* broken */
> assert(safe_indirect_branch == SPAPR_CAP_BROKEN);
> break;
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr: add missing break in h_get_cpu_characteristics()
2018-02-02 9:11 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
@ 2018-02-02 10:00 ` Greg Kurz
2018-02-02 11:18 ` Daniel Henrique Barboza
0 siblings, 1 reply; 6+ messages in thread
From: Greg Kurz @ 2018-02-02 10:00 UTC (permalink / raw)
To: Daniel Henrique Barboza
Cc: qemu-devel, qemu-ppc, Suraj Jitindar Singh, David Gibson,
Paolo Bonzini
On Fri, 2 Feb 2018 07:11:08 -0200
Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> wrote:
> On 02/01/2018 05:47 PM, Greg Kurz wrote:
> > Detected by Coverity (CID 1385702). This fixes the recently added hypercall
> > to let guests properly apply Spectre and Meltdown workarounds.
>
> Paolo Bonzini reported this error in a reply to the pull request that
> added the patch:
>
> "Re: [Qemu-ppc] [Qemu-devel] [PULL 12/12] target/ppc/spapr: Add H-Call
> H_GET_CPU_CHARACTERISTICS
>
> On 28/01/2018 22:28, David Gibson wrote:
>
> > + switch (safe_indirect_branch) {
> > + case SPAPR_CAP_FIXED:
> > + characteristics |= H_CPU_CHAR_BCCTRL_SERIALISED;
>
> Missing "break;" here.
>
> Paolo
>
> "
>
> I think it is nice to mention in the commit msg that Paolo also detected
> this same error,
> specially given that his email was sent before this patch.
>
Heh, Paolo's mail landed in the pull req thread in my mail client and I saw
it after sending the patch :P ... also I'm pretty sure Paolo was made aware
of this issue by Coverity, just as I was :)
From: scan-admin@coverity.com
To: groug@kaod.org
Subject: New Defects reported by Coverity Scan for QEMU
Date: Thu, 01 Feb 2018 18:11:33 +0000 (UTC)
Hi,
Please find the latest report on new defect(s) introduced to QEMU found with
Coverity Scan.
...
*** CID 1385702: Control flow issues (MISSING_BREAK)
/hw/ppc/spapr_hcall.c: 1700 in h_get_cpu_characteristics()
1694 break;
1695 }
1696
1697 switch (safe_indirect_branch) {
1698 case SPAPR_CAP_FIXED:
1699 characteristics |= H_CPU_CHAR_BCCTRL_SERIALISED;
>>> CID 1385702: Control flow issues (MISSING_BREAK)
>>> The above case falls through to this one.
1700 default: /* broken */
1701 assert(safe_indirect_branch == SPAPR_CAP_BROKEN);
1702 break;
1703 }
1704
1705 args[0] = characteristics;
No big deal I guess :)
>
> Thanks,
>
>
> Daniel
>
>
> >
> > Fixes: c59704b25473 "target/ppc/spapr: Add H-Call H_GET_CPU_CHARACTERISTICS"
> > Signed-off-by: Greg Kurz <groug@kaod.org>
> > ---
> > hw/ppc/spapr_hcall.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> > index 4d0e6eb0cf1d..596f58378a40 100644
> > --- a/hw/ppc/spapr_hcall.c
> > +++ b/hw/ppc/spapr_hcall.c
> > @@ -1697,6 +1697,7 @@ static target_ulong h_get_cpu_characteristics(PowerPCCPU *cpu,
> > switch (safe_indirect_branch) {
> > case SPAPR_CAP_FIXED:
> > characteristics |= H_CPU_CHAR_BCCTRL_SERIALISED;
> > + break;
> > default: /* broken */
> > assert(safe_indirect_branch == SPAPR_CAP_BROKEN);
> > break;
> >
> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [Qemu-ppc] [PATCH] spapr: add missing break in h_get_cpu_characteristics()
2018-02-02 10:00 ` Greg Kurz
@ 2018-02-02 11:18 ` Daniel Henrique Barboza
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Henrique Barboza @ 2018-02-02 11:18 UTC (permalink / raw)
To: Greg Kurz
Cc: qemu-devel, qemu-ppc, Suraj Jitindar Singh, David Gibson,
Paolo Bonzini
On 02/02/2018 08:00 AM, Greg Kurz wrote:
> On Fri, 2 Feb 2018 07:11:08 -0200
> Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com> wrote:
>
>> On 02/01/2018 05:47 PM, Greg Kurz wrote:
>>> Detected by Coverity (CID 1385702). This fixes the recently added hypercall
>>> to let guests properly apply Spectre and Meltdown workarounds.
>> Paolo Bonzini reported this error in a reply to the pull request that
>> added the patch:
>>
>> "Re: [Qemu-ppc] [Qemu-devel] [PULL 12/12] target/ppc/spapr: Add H-Call
>> H_GET_CPU_CHARACTERISTICS
>>
>> On 28/01/2018 22:28, David Gibson wrote:
>>
>>> + switch (safe_indirect_branch) {
>>> + case SPAPR_CAP_FIXED:
>>> + characteristics |= H_CPU_CHAR_BCCTRL_SERIALISED;
>> Missing "break;" here.
>>
>> Paolo
>>
>> "
>>
>> I think it is nice to mention in the commit msg that Paolo also detected
>> this same error,
>> specially given that his email was sent before this patch.
>>
> Heh, Paolo's mail landed in the pull req thread in my mail client and I saw
> it after sending the patch :P ... also I'm pretty sure Paolo was made aware
> of this issue by Coverity, just as I was :)
>
> From: scan-admin@coverity.com
> To: groug@kaod.org
> Subject: New Defects reported by Coverity Scan for QEMU
> Date: Thu, 01 Feb 2018 18:11:33 +0000 (UTC)
>
> Hi,
>
> Please find the latest report on new defect(s) introduced to QEMU found with
> Coverity Scan.
>
> ...
>
> *** CID 1385702: Control flow issues (MISSING_BREAK)
> /hw/ppc/spapr_hcall.c: 1700 in h_get_cpu_characteristics()
> 1694 break;
> 1695 }
> 1696
> 1697 switch (safe_indirect_branch) {
> 1698 case SPAPR_CAP_FIXED:
> 1699 characteristics |= H_CPU_CHAR_BCCTRL_SERIALISED;
>>>> CID 1385702: Control flow issues (MISSING_BREAK)
>>>> The above case falls through to this one.
> 1700 default: /* broken */
> 1701 assert(safe_indirect_branch == SPAPR_CAP_BROKEN);
> 1702 break;
> 1703 }
> 1704
> 1705 args[0] = characteristics;
>
>
> No big deal I guess :)
Roger that!
>
>> Thanks,
>>
>>
>> Daniel
>>
>>
>>> Fixes: c59704b25473 "target/ppc/spapr: Add H-Call H_GET_CPU_CHARACTERISTICS"
>>> Signed-off-by: Greg Kurz <groug@kaod.org>
>>> ---
>>> hw/ppc/spapr_hcall.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
>>> index 4d0e6eb0cf1d..596f58378a40 100644
>>> --- a/hw/ppc/spapr_hcall.c
>>> +++ b/hw/ppc/spapr_hcall.c
>>> @@ -1697,6 +1697,7 @@ static target_ulong h_get_cpu_characteristics(PowerPCCPU *cpu,
>>> switch (safe_indirect_branch) {
>>> case SPAPR_CAP_FIXED:
>>> characteristics |= H_CPU_CHAR_BCCTRL_SERIALISED;
>>> + break;
>>> default: /* broken */
>>> assert(safe_indirect_branch == SPAPR_CAP_BROKEN);
>>> break;
>>>
>>>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] spapr: add missing break in h_get_cpu_characteristics()
2018-02-01 19:47 [Qemu-devel] [PATCH] spapr: add missing break in h_get_cpu_characteristics() Greg Kurz
2018-02-02 4:31 ` Suraj Jitindar Singh
2018-02-02 9:11 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
@ 2018-02-08 23:28 ` David Gibson
2 siblings, 0 replies; 6+ messages in thread
From: David Gibson @ 2018-02-08 23:28 UTC (permalink / raw)
To: Greg Kurz
Cc: qemu-devel, qemu-ppc, Suraj Jitindar Singh, Alexey Kardashevskiy
[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]
On Thu, Feb 01, 2018 at 08:47:41PM +0100, Greg Kurz wrote:
> Detected by Coverity (CID 1385702). This fixes the recently added hypercall
> to let guests properly apply Spectre and Meltdown workarounds.
>
> Fixes: c59704b25473 "target/ppc/spapr: Add H-Call H_GET_CPU_CHARACTERISTICS"
> Signed-off-by: Greg Kurz <groug@kaod.org>
Applied to ppc-for-2.12, thanks.
> ---
> hw/ppc/spapr_hcall.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
> index 4d0e6eb0cf1d..596f58378a40 100644
> --- a/hw/ppc/spapr_hcall.c
> +++ b/hw/ppc/spapr_hcall.c
> @@ -1697,6 +1697,7 @@ static target_ulong h_get_cpu_characteristics(PowerPCCPU *cpu,
> switch (safe_indirect_branch) {
> case SPAPR_CAP_FIXED:
> characteristics |= H_CPU_CHAR_BCCTRL_SERIALISED;
> + break;
> default: /* broken */
> assert(safe_indirect_branch == SPAPR_CAP_BROKEN);
> break;
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-02-08 23:28 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-01 19:47 [Qemu-devel] [PATCH] spapr: add missing break in h_get_cpu_characteristics() Greg Kurz
2018-02-02 4:31 ` Suraj Jitindar Singh
2018-02-02 9:11 ` [Qemu-devel] [Qemu-ppc] " Daniel Henrique Barboza
2018-02-02 10:00 ` Greg Kurz
2018-02-02 11:18 ` Daniel Henrique Barboza
2018-02-08 23:28 ` [Qemu-devel] " David Gibson
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).