]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/ivshmem.c don't check for negative values on unsigned data types
authorJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 30 Aug 2010 10:31:33 +0000 (12:31 +0200)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 4 Sep 2010 09:52:25 +0000 (09:52 +0000)
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>
hw/ivshmem.c

index bbb5cbaa1678d061d12840dc233678c914866450..afebbc3657ac46a73a28a184fd70796d2c230388 100644 (file)
@@ -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],