summaryrefslogtreecommitdiff
path: root/hw/ivshmem.c
diff options
context:
space:
mode:
authorJes Sorensen <Jes.Sorensen@redhat.com>2010-08-30 12:31:33 +0200
committerBlue Swirl <blauwirbel@gmail.com>2010-09-04 09:52:25 +0000
commit1b27d7a1e8609b2eeb6238f2c629eb82217523f6 (patch)
treec296b1ef7ee545603c3b7c144d2bf194ca672dca /hw/ivshmem.c
parent37a05af069e14d435fe8fb2cd8c7a8b2f16d137f (diff)
downloadqemu-1b27d7a1e8609b2eeb6238f2c629eb82217523f6.tar.gz
qemu-1b27d7a1e8609b2eeb6238f2c629eb82217523f6.tar.bz2
qemu-1b27d7a1e8609b2eeb6238f2c629eb82217523f6.zip
hw/ivshmem.c don't check for negative values on unsigned data types
There is no need to check for dest < 0 or vector >= 0 as both are uint16_t. This should fix problems with broken build with aggressive compiler flags. Reported by Xudong Hao <xudong.hao@intel.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Cam Macdonell <cam@cs.ualberta.ca> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/ivshmem.c')
-rw-r--r--hw/ivshmem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index bbb5cbaa16..afebbc3657 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -199,13 +199,13 @@ static void ivshmem_io_writel(void *opaque, target_phys_addr_t addr,
case DOORBELL:
/* check that dest VM ID is reasonable */
- if ((dest < 0) || (dest > s->max_peer)) {
+ if (dest > s->max_peer) {
IVSHMEM_DPRINTF("Invalid destination VM ID (%d)\n", dest);
break;
}
/* check doorbell range */
- if ((vector >= 0) && (vector < s->peers[dest].nb_eventfds)) {
+ if (vector < s->peers[dest].nb_eventfds) {
IVSHMEM_DPRINTF("Writing %" PRId64 " to VM %d on vector %d\n",
write_one, dest, vector);
if (write(s->peers[dest].eventfds[vector],