Skip to contentSkip to conversation

ivshmem: remove unnecessary checks for unsigned

PATCH In review Hidetoshi Seto 3 participants 4 messages Sep 3, 2010 – Sep 6, 2010 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ivshmem: remove unnecessary checks for unsigned

fixes gcc 4.1 warning:
In function 'ivshmem_io_writel':
202: warning: comparison is always false due to limited range of data type 208: warning: comparison is always true due to limited range of data type

---
 hw/ivshmem.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/ivshmem.c +2 -2
index bbb5cba..afebbc3 100644
@@ -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],
Signature · 1 line
1.7.2.2
#1 lore raw
Quoted 20 lines · Hidetoshi Seto

fixes gcc 4.1 warning:
In function 'ivshmem_io_writel':
202: warning: comparison is always false due to limited range of data type 208: warning: comparison is always true due to limited range of data type

---
 hw/ivshmem.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/ivshmem.c +1 -1
index bbb5cba..afebbc3 100644
@@ -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) {

hw/ivshmem.c static void ivshmem_io_writel(void *opaque, target_phys_addr_t addr, · line 211

Quoted 10 lines
hw/ivshmem.c +1 -1
                 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],

Oops, since I've registered qemu-kvm ML but not qemu-devel ML, I could not noticed that Jes have already posted same patch to qemu-devel.

Now build of ivshmem is enabled only on KVM systems, please apply this patch to qemu-kvm.git asap.

Thanks,
H.Seto

#2 lore raw
Quoted 7 lines · Hidetoshi Seto

Oops, since I've registered qemu-kvm ML but not qemu-devel ML, I could not noticed that Jes have already posted same patch to qemu-devel.

Now build of ivshmem is enabled only on KVM systems, please apply this patch to qemu-kvm.git asap.

This was already applied to qemu.git; I'll pull it into qemu-kvm.git to fix the build.

Signature · 1 line
error compiling committee.c: too many arguments to function
#3 lore raw
Quoted 6 lines · Avi Kivity
Quoted 5 lines · Hidetoshi Seto

Oops, since I've registered qemu-kvm ML but not qemu-devel ML, I could not noticed that Jes have already posted same patch to qemu-devel.

Quoted 6 lines
Quoted 3 lines

Now build of ivshmem is enabled only on KVM systems, please apply this patch to qemu-kvm.git asap.

This was already applied to qemu.git; I'll pull it into qemu-kvm.git to fix the build.

Qemu-kvm 6ee63ef38696aa3b0518f6aa6b85bc111ba7ca4e can build successfully now, thanks all.

-Xudong