A couple of IPMI bugs
cover A couple of IPMI bugs
Found by Paulo and Coverity.
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.
--- hw/ipmi/ipmi_bmc_sim.c | 2 ++ 1 file changed, 2 insertions(+)
hw/ipmi/ipmi_bmc_sim.c +2 -0
@@ -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
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.
--- hw/ipmi/ipmi_bmc_sim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ipmi/ipmi_bmc_sim.c +1 -1
@@ -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
Michael, these were missing in your pull request, probably because you weren't CCed. Do you want me to pick them instead?
Thanks,
Paolo
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]>Signed-off-by Corey Minyard <[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@@ -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
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]>Signed-off-by Corey Minyard <[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@@ -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
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