[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 01/17] virito-pci: fix OVERRUN problem
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 01/17] virito-pci: fix OVERRUN problem |
Date: |
Fri, 26 Jun 2015 15:45:42 +0200 |
From: Gonglei <address@hidden>
Overrunning array "proxy->guest_features" of 2 4-byte
elements at element index 2 (byte offset 8) using index
"proxy->gfselect" (which evaluates to 2). Normally, the
Linux kernel driver just read/write '0' or '1' as the
"proxy->gfselect" values, so using '<' instead of '=<' to
make coverity happy and avoid potential harm.
Cc: Michael S. Tsirkin <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/virtio/virtio-pci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index d7cf34c..ce1c46e 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -977,7 +977,7 @@ static uint64_t virtio_pci_common_read(void *opaque, hwaddr
addr,
val = proxy->gfselect;
break;
case VIRTIO_PCI_COMMON_GF:
- if (proxy->gfselect <= ARRAY_SIZE(proxy->guest_features)) {
+ if (proxy->gfselect < ARRAY_SIZE(proxy->guest_features)) {
val = proxy->guest_features[proxy->gfselect];
}
break;
@@ -1052,7 +1052,7 @@ static void virtio_pci_common_write(void *opaque, hwaddr
addr,
proxy->gfselect = val;
break;
case VIRTIO_PCI_COMMON_GF:
- if (proxy->gfselect <= ARRAY_SIZE(proxy->guest_features)) {
+ if (proxy->gfselect < ARRAY_SIZE(proxy->guest_features)) {
proxy->guest_features[proxy->gfselect] = val;
virtio_set_features(vdev,
(((uint64_t)proxy->guest_features[1]) << 32) |
--
MST
- [Qemu-devel] [PULL 00/17] virtio, pci fixes, enhancements, Michael S. Tsirkin, 2015/06/26
- [Qemu-devel] [PULL 01/17] virito-pci: fix OVERRUN problem,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 02/17] qdev: fix OVERFLOW_BEFORE_WIDEN, Michael S. Tsirkin, 2015/06/26
- [Qemu-devel] [PULL 03/17] balloon: add a feature bit to let Guest OS deflate balloon on oom, Michael S. Tsirkin, 2015/06/26
- [Qemu-devel] [PULL 04/17] vhost: correctly pass error to caller in vhost_dev_enable_notifiers(), Michael S. Tsirkin, 2015/06/26
- [Qemu-devel] [PULL 05/17] MAINTAINERS: add ACPI entry, Michael S. Tsirkin, 2015/06/26
- [Qemu-devel] [PULL 06/17] pc: cleanup and convert TMP ACPI device description to AML API, Michael S. Tsirkin, 2015/06/26
- [Qemu-devel] [PULL 07/17] add pci-bridge-seat, Michael S. Tsirkin, 2015/06/26
- [Qemu-devel] [PULL 08/17] migration: introduce VMSTATE_BUFFER_UNSAFE_INFO_TEST(), Michael S. Tsirkin, 2015/06/26
- [Qemu-devel] [PULL 09/17] hw/pci-bridge: expose _test parameter in SHPC_VMSTATE(), Michael S. Tsirkin, 2015/06/26
- [Qemu-devel] [PULL 10/17] hw/pci-bridge: add macro for "chassis_nr" property, Michael S. Tsirkin, 2015/06/26
- [Qemu-devel] [PULL 11/17] hw/pci-bridge: add macro for "msi" property, Michael S. Tsirkin, 2015/06/26