|
|
3a13dd |
From: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
3a13dd |
Date: Wed, 31 Aug 2016 17:36:07 +0530
|
|
|
3a13dd |
Subject: [PATCH] scsi: mptconfig: fix an assert expression
|
|
|
3a13dd |
|
|
|
3a13dd |
When LSI SAS1068 Host Bus emulator builds configuration page
|
|
|
3a13dd |
headers, mptsas_config_pack() should assert that the size
|
|
|
3a13dd |
fits in a byte. However, the size is expressed in 32-bit
|
|
|
3a13dd |
units, so up to 1020 bytes fit. The assertion was only
|
|
|
3a13dd |
allowing replies up to 252 bytes, so fix it.
|
|
|
3a13dd |
|
|
|
3a13dd |
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
3a13dd |
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
|
|
|
3a13dd |
Message-Id: <1472645167-30765-2-git-send-email-ppandit@redhat.com>
|
|
|
3a13dd |
Cc: qemu-stable@nongnu.org
|
|
|
3a13dd |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
3a13dd |
(cherry picked from commit cf2bce203a45d7437029d108357fb23fea0967b6)
|
|
|
3a13dd |
---
|
|
|
3a13dd |
hw/scsi/mptconfig.c | 2 +-
|
|
|
3a13dd |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
3a13dd |
|
|
|
3a13dd |
diff --git a/hw/scsi/mptconfig.c b/hw/scsi/mptconfig.c
|
|
|
3a13dd |
index 7071854..3e4f400 100644
|
|
|
3a13dd |
--- a/hw/scsi/mptconfig.c
|
|
|
3a13dd |
+++ b/hw/scsi/mptconfig.c
|
|
|
3a13dd |
@@ -158,7 +158,7 @@ static size_t mptsas_config_pack(uint8_t **data, const char *fmt, ...)
|
|
|
3a13dd |
va_end(ap);
|
|
|
3a13dd |
|
|
|
3a13dd |
if (data) {
|
|
|
3a13dd |
- assert(ret < 256 && (ret % 4) == 0);
|
|
|
3a13dd |
+ assert(ret / 4 < 256 && (ret % 4) == 0);
|
|
|
3a13dd |
stb_p(*data + 1, ret / 4);
|
|
|
3a13dd |
}
|
|
|
3a13dd |
return ret;
|