Skip to contentSkip to conversation

A couple of IPMI bugs

PATCH In review [email protected] 3 participants 7 messages Jan 11, 2016 – Feb 8, 2016

lore
Share & tools
lore
#3 lore raw

PATCH 2/2 ipmi_bmc_sim: Add break to correct watchdog NMI check

From: Corey Minyard <[email protected]>

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 <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Shannon Zhao <[email protected]>
Cc Xiao Guangrong <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
---
 hw/ipmi/ipmi_bmc_sim.c | 2 ++
 1 file changed, 2 insertions(+)
hw/ipmi/ipmi_bmc_sim.c +2 -0
index 3ecf02e..e522ffa 100644
@@ -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;
Signature · 1 line
2.5.0
#1 lore raw

PATCH 1/2 ipmi_bmc_sim: Fix off by one in check.

In reply to [email protected]

From: Corey Minyard <[email protected]>

Found by Paolo.

Cc Paolo Bonzini <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Shannon Zhao <[email protected]>
Cc Xiao Guangrong <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
---
 hw/ipmi/ipmi_bmc_sim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ipmi/ipmi_bmc_sim.c +1 -1
index 0a59e53..3ecf02e 100644
@@ -546,7 +546,7 @@ static void ipmi_init_sensors_from_sdrs(IPMIBmcSim *s)
 static int ipmi_register_netfn(IPMIBmcSim *s, unsigned int netfn,
                                const IPMINetfn *netfnd)
 {
-    if ((netfn & 1) || (netfn > MAX_NETFNS) || (s->netfns[netfn / 2])) {
+    if ((netfn & 1) || (netfn >= MAX_NETFNS) || (s->netfns[netfn / 2])) {
         return -1;
     }
     s->netfns[netfn / 2] = netfnd;
Signature · 1 line
2.5.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] ipmi_bmc_sim: Fix off by one in check.

In reply to [email protected]
Quoted 11 lines · On Mon, Jan 11, 2016 at 07:32:31AM -0600, [email protected] wrote:

From: Corey Minyard <[email protected]>

Found by Paolo.

Cc Paolo Bonzini <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Shannon Zhao <[email protected]>
Cc Xiao Guangrong <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Quoted 19 lines
---
 hw/ipmi/ipmi_bmc_sim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ipmi/ipmi_bmc_sim.c +1 -1
index 0a59e53..3ecf02e 100644
@@ -546,7 +546,7 @@ static void ipmi_init_sensors_from_sdrs(IPMIBmcSim *s)
 static int ipmi_register_netfn(IPMIBmcSim *s, unsigned int netfn,
                                const IPMINetfn *netfnd)
 {
-    if ((netfn & 1) || (netfn > MAX_NETFNS) || (s->netfns[netfn / 2])) {
+    if ((netfn & 1) || (netfn >= MAX_NETFNS) || (s->netfns[netfn / 2])) {
         return -1;
     }
     s->netfns[netfn / 2] = netfnd;
Signature · 1 line
2.5.0
Reviewed-by on v1 2/2
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] ipmi_bmc_sim: Add break to correct watchdog NMI check

In reply to [email protected]
Quoted 6 lines · On Mon, Jan 11, 2016 at 07:32:32AM -0600, [email protected] wrote:

From: Corey Minyard <[email protected]>

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.

Quoted 7 lines
Cc Paolo Bonzini <[email protected]>
Cc Michael S. Tsirkin <[email protected]>
Cc Peter Maydell <[email protected]>
Cc Shannon Zhao <[email protected]>
Cc Xiao Guangrong <[email protected]>
Cc Stefan Hajnoczi <[email protected]>
Quoted 19 lines
---
 hw/ipmi/ipmi_bmc_sim.c | 2 ++
 1 file changed, 2 insertions(+)
hw/ipmi/ipmi_bmc_sim.c +2 -0
index 3ecf02e..e522ffa 100644
@@ -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;
Signature · 1 line
2.5.0
#6 lore raw
In reply to Paolo Bonzini
Quoted 2 lines · Paolo Bonzini

Michael, these were missing in your pull request, probably because you weren't CCed. Do you want me to pick them instead?

Sure, go ahead.
Thanks!

Quoted 3 lines

Thanks,

Paolo