]>
Commit | Line | Data |
---|---|---|
68a30562 WB |
1 | From a0e2a28c08472ad3468c2f75d20fe1ca02ef8c0b Mon Sep 17 00:00:00 2001 |
2 | From: Prasad J Pandit <pjp@fedoraproject.org> | |
3 | Date: Wed, 31 Aug 2016 17:36:07 +0530 | |
4 | Subject: [PATCH 6/6] scsi: mptconfig: fix an assert expression | |
5 | ||
6 | When LSI SAS1068 Host Bus emulator builds configuration page | |
7 | headers, mptsas_config_pack() should assert that the size | |
8 | fits in a byte. However, the size is expressed in 32-bit | |
9 | units, so up to 1020 bytes fit. The assertion was only | |
10 | allowing replies up to 252 bytes, so fix it. | |
11 | ||
12 | Suggested-by: Paolo Bonzini <pbonzini@redhat.com> | |
13 | Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org> | |
14 | Message-Id: <1472645167-30765-2-git-send-email-ppandit@redhat.com> | |
15 | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> | |
16 | --- | |
17 | hw/scsi/mptconfig.c | 2 +- | |
18 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
19 | ||
20 | diff --git a/hw/scsi/mptconfig.c b/hw/scsi/mptconfig.c | |
21 | index 7071854..3e4f400 100644 | |
22 | --- a/hw/scsi/mptconfig.c | |
23 | +++ b/hw/scsi/mptconfig.c | |
24 | @@ -158,7 +158,7 @@ static size_t mptsas_config_pack(uint8_t **data, const char *fmt, ...) | |
25 | va_end(ap); | |
26 | ||
27 | if (data) { | |
28 | - assert(ret < 256 && (ret % 4) == 0); | |
29 | + assert(ret / 4 < 256 && (ret % 4) == 0); | |
30 | stb_p(*data + 1, ret / 4); | |
31 | } | |
32 | return ret; | |
33 | -- | |
34 | 2.1.4 | |
35 |