mirror of https://github.com/xemu-project/xemu.git
scsi: mptsas: fix the wrong reading size in fetch request
When fetching request, it should read sizeof(*hdr), not the pointer hdr. Signed-off-by: Li Qiang <liqiang6-s@360.cn> Message-Id: <1489488980-130668-1-git-send-email-liqiang6-s@360.cn> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
bd5d983fa8
commit
b01a2d07c9
|
@ -756,7 +756,7 @@ static void mptsas_fetch_request(MPTSASState *s)
|
||||||
|
|
||||||
/* Read the message header from the guest first. */
|
/* Read the message header from the guest first. */
|
||||||
addr = s->host_mfa_high_addr | MPTSAS_FIFO_GET(s, request_post);
|
addr = s->host_mfa_high_addr | MPTSAS_FIFO_GET(s, request_post);
|
||||||
pci_dma_read(pci, addr, req, sizeof(hdr));
|
pci_dma_read(pci, addr, req, sizeof(*hdr));
|
||||||
|
|
||||||
if (hdr->Function < ARRAY_SIZE(mpi_request_sizes) &&
|
if (hdr->Function < ARRAY_SIZE(mpi_request_sizes) &&
|
||||||
mpi_request_sizes[hdr->Function]) {
|
mpi_request_sizes[hdr->Function]) {
|
||||||
|
@ -766,8 +766,8 @@ static void mptsas_fetch_request(MPTSASState *s)
|
||||||
*/
|
*/
|
||||||
size = mpi_request_sizes[hdr->Function];
|
size = mpi_request_sizes[hdr->Function];
|
||||||
assert(size <= MPTSAS_MAX_REQUEST_SIZE);
|
assert(size <= MPTSAS_MAX_REQUEST_SIZE);
|
||||||
pci_dma_read(pci, addr + sizeof(hdr), &req[sizeof(hdr)],
|
pci_dma_read(pci, addr + sizeof(*hdr), &req[sizeof(*hdr)],
|
||||||
size - sizeof(hdr));
|
size - sizeof(*hdr));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hdr->Function == MPI_FUNCTION_SCSI_IO_REQUEST) {
|
if (hdr->Function == MPI_FUNCTION_SCSI_IO_REQUEST) {
|
||||||
|
|
Loading…
Reference in New Issue