summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorCédric Le Goater <clg@fr.ibm.com>2016-01-25 15:07:30 +0100
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:31:48 -0600
commit75eb30d82eaf562f59f2bae854108b1965237cc3 (patch)
tree9dcbbf856442f0de23c6949525c246d607c521b7 /hw
parentaae3c2003de32785264a93dff6fccb7e5881619f (diff)
downloadhqemu-75eb30d82eaf562f59f2bae854108b1965237cc3.zip
hqemu-75eb30d82eaf562f59f2bae854108b1965237cc3.tar.gz
ipmi: fix SDR length value
The IPMI BMC simulator populates the SDR table with a set of initial SDRs. The length of each SDR is taken from the record itself (byte 4) which does not include the size of the header. But, the full length (header + data) is required by the sdr_add_entry() routine. Signed-off-by: Cédric Le Goater <clg@fr.ibm.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/ipmi/ipmi_bmc_sim.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
index d8ca76a..73a4f6a 100644
--- a/hw/ipmi/ipmi_bmc_sim.c
+++ b/hw/ipmi/ipmi_bmc_sim.c
@@ -356,7 +356,7 @@ static int sdr_find_entry(IPMISdr *sdr, uint16_t recid,
while (pos < sdr->next_free) {
uint16_t trec = sdr->sdr[pos] | (sdr->sdr[pos + 1] << 8);
- unsigned int nextpos = pos + sdr->sdr[pos + 4];
+ unsigned int nextpos = pos + sdr->sdr[pos + 4] + 5;
if (trec == recid) {
if (nextrec) {
@@ -1164,7 +1164,7 @@ static void get_sdr(IPMIBmcSim *ibs,
rsp[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT;
return;
}
- if (cmd[6] > (ibs->sdr.sdr[pos + 4])) {
+ if (cmd[6] > (ibs->sdr.sdr[pos + 4] + 5)) {
rsp[2] = IPMI_CC_PARM_OUT_OF_RANGE;
return;
}
@@ -1173,7 +1173,7 @@ static void get_sdr(IPMIBmcSim *ibs,
IPMI_ADD_RSP_DATA((nextrec >> 8) & 0xff);
if (cmd[7] == 0xff) {
- cmd[7] = ibs->sdr.sdr[pos + 4] - cmd[6];
+ cmd[7] = ibs->sdr.sdr[pos + 4] + 5 - cmd[6];
}
if ((cmd[7] + *rsp_len) > max_rsp_len) {
@@ -1647,17 +1647,17 @@ static void ipmi_sim_init(Object *obj)
error_report("Problem with recid 0x%4.4x", i);
return;
}
- len = init_sdrs[i + 4];
+ len = init_sdrs[i + 4] + 5;
recid = init_sdrs[i] | (init_sdrs[i + 1] << 8);
if (recid == 0xffff) {
break;
}
- if ((i + len + 5) > sizeof(init_sdrs)) {
+ if ((i + len) > sizeof(init_sdrs)) {
error_report("Problem with recid 0x%4.4x", i);
return;
}
sdr_add_entry(ibs, init_sdrs + i, len, NULL);
- i += len + 5;
+ i += len;
}
ipmi_init_sensors_from_sdrs(ibs);
OpenPOWER on IntegriCloud