[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 21/49] ipmi: fix SDR length value
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 21/49] ipmi: fix SDR length value |
Date: |
Thu, 4 Feb 2016 23:52:22 +0200 |
From: Cédric Le Goater <address@hidden>
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 <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/ipmi/ipmi_bmc_sim.c | 12 ++++++------
1 file 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);
--
MST
- [Qemu-devel] [PULL 10/49] vring: slim down allocation of VirtQueueElements, (continued)
- [Qemu-devel] [PULL 10/49] vring: slim down allocation of VirtQueueElements, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 11/49] virtio: combine the read of a descriptor, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 12/49] virtio: cache used_idx in a VirtQueue field, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 13/49] virtio: read avail_idx from VQ only when necessary, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 15/49] hw/pxb: add pxb devices to the bridge category, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 16/49] vhost-user-test: use correct ROM to speed up and avoid spurious failures, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 17/49] hw/pci: ensure that only PCI/PCIe bridges can be attached to pxb/pxb-pcie devices, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 18/49] ipmi: replace goto by a return statement, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 19/49] ipmi: replace *_MAXCMD defines, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 20/49] ipmi: cleanup error_report messages, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 21/49] ipmi: fix SDR length value,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 22/49] ipmi: introduce a struct ipmi_sdr_compact, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 23/49] ipmi: add get and set SENSOR_TYPE commands, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 24/49] ipmi: add GET_SYS_RESTART_CAUSE chassis command, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 25/49] ipmi: add ACPI power and GUID commands, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 26/49] pc: Move PcGuestInfo declaration to top of file, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 27/49] pc: Eliminate struct PcGuestInfoState, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 28/49] pc: Simplify pc_memory_init() signature, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 29/49] pc: Simplify xen_load_linux() signature, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 30/49] acpi: Remove guest_info parameters from functions, Michael S. Tsirkin, 2016/02/04
- [Qemu-devel] [PULL 31/49] acpi: Don't save PcGuestInfo on AcpiBuildState, Michael S. Tsirkin, 2016/02/04