aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrasad J Pandit <pjp@fedoraproject.org>2016-08-31 17:36:07 +0530
committerMichael Roth <mdroth@linux.vnet.ibm.com>2016-09-20 11:03:33 -0500
commit5e39560941f6b3ee61ea24c7a34e8fcf9e291fca (patch)
tree5c6bc8098368c5f47f97fca9d325ccade8097cd3
parentda99530e410349d672e792e820b355a648d430fa (diff)
downloadqemu-5e39560941f6b3ee61ea24c7a34e8fcf9e291fca.zip
qemu-5e39560941f6b3ee61ea24c7a34e8fcf9e291fca.tar.gz
qemu-5e39560941f6b3ee61ea24c7a34e8fcf9e291fca.tar.bz2
scsi: mptconfig: fix an assert expression
When LSI SAS1068 Host Bus emulator builds configuration page headers, mptsas_config_pack() should assert that the size fits in a byte. However, the size is expressed in 32-bit units, so up to 1020 bytes fit. The assertion was only allowing replies up to 252 bytes, so fix it. Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> Message-Id: <1472645167-30765-2-git-send-email-ppandit@redhat.com> Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit cf2bce203a45d7437029d108357fb23fea0967b6) Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
-rw-r--r--hw/scsi/mptconfig.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/scsi/mptconfig.c b/hw/scsi/mptconfig.c
index 7071854..3e4f400 100644
--- a/hw/scsi/mptconfig.c
+++ b/hw/scsi/mptconfig.c
@@ -158,7 +158,7 @@ static size_t mptsas_config_pack(uint8_t **data, const char *fmt, ...)
va_end(ap);
if (data) {
- assert(ret < 256 && (ret % 4) == 0);
+ assert(ret / 4 < 256 && (ret % 4) == 0);
stb_p(*data + 1, ret / 4);
}
return ret;