]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
scsi: mptconfig: fix an assert expression
authorPrasad J Pandit <pjp@fedoraproject.org>
Wed, 31 Aug 2016 12:06:07 +0000 (17:36 +0530)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 20 Sep 2016 16:03:33 +0000 (11:03 -0500)
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>
hw/scsi/mptconfig.c

index 707185469e4ec2093def7bf8249b0a1818947e16..3e4f4001157072bf0351b5aef839e43bf6ea409c 100644 (file)
@@ -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;