diff mbox

[2/2] ipmi_bmc_sim: Add break to correct watchdog NMI check

Message ID 1452519152-6500-3-git-send-email-minyard@acm.org
State New
Headers show

Commit Message

Corey Minyard Jan. 11, 2016, 1:32 p.m. UTC
From: Corey Minyard <cminyard@mvista.com>

It was falling through when it should have been a break.  Found by
Coverity.  The logic could be simplified a bit with a fallthrough,
probably the original thought, but that would be less clear, I think.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Shannon Zhao <zhaoshenglong@huawei.com>
Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
 hw/ipmi/ipmi_bmc_sim.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Michael S. Tsirkin Feb. 8, 2016, 10:43 a.m. UTC | #1
On Mon, Jan 11, 2016 at 07:32:32AM -0600, minyard@acm.org wrote:
> From: Corey Minyard <cminyard@mvista.com>
> 
> It was falling through when it should have been a break.  Found by
> Coverity.  The logic could be simplified a bit with a fallthrough,
> probably the original thought, but that would be less clear, I think.
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Peter Maydell <peter.maydell@linaro.org>
> Cc: Shannon Zhao <zhaoshenglong@huawei.com>
> Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>
> Cc: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  hw/ipmi/ipmi_bmc_sim.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
> index 3ecf02e..e522ffa 100644
> --- a/hw/ipmi/ipmi_bmc_sim.c
> +++ b/hw/ipmi/ipmi_bmc_sim.c
> @@ -1101,6 +1101,8 @@ static void set_watchdog_timer(IPMIBmcSim *ibs,
>              rsp[2] = IPMI_CC_INVALID_DATA_FIELD;
>              goto out;
>          }
> +        break;
> +
>      default:
>          /* We don't support PRE_SMI */
>          rsp[2] = IPMI_CC_INVALID_DATA_FIELD;
> -- 
> 2.5.0
diff mbox

Patch

diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
index 3ecf02e..e522ffa 100644
--- a/hw/ipmi/ipmi_bmc_sim.c
+++ b/hw/ipmi/ipmi_bmc_sim.c
@@ -1101,6 +1101,8 @@  static void set_watchdog_timer(IPMIBmcSim *ibs,
             rsp[2] = IPMI_CC_INVALID_DATA_FIELD;
             goto out;
         }
+        break;
+
     default:
         /* We don't support PRE_SMI */
         rsp[2] = IPMI_CC_INVALID_DATA_FIELD;