Skip to contentSkip to conversation

Fix vhost_net compilation errors for i386-softmmu target

PATCH In review Michal Novotny 3 participants 4 messages Sep 20, 2010 – Sep 21, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix vhost_net compilation errors for i386-softmmu target

Hi,
there were compilation errors when I was trying to compile i386-softmmu target on i386 host (running on Fedora-13 with development version of qemu downloaded from git).

There were errors of comparison of unsigned expression was always true which made it unable to compile. This simple fix fixes the issue.

...
cc1: warnings being treated as errors
.../hw/vhost_net.c: In function ‘vhost_net_start’:
.../vhost_net.c:154: error: comparison of unsigned expression >= 0 is always true make[1]: *** [vhost_net.o] Error 1
make: *** [subdir-i386-softmmu] Error 2

Signature · 2 lines
Michal Novotny<[email protected]>, RHCE
Virtualization Team (xen userspace), Red Hat
Quoted 1 line

From 21dd405dbc871c8d0053cc68f8862665dc12f69a Mon Sep 17 00:00:00 2001

From: Michal Novotny <[email protected]>
Date: Mon, 20 Sep 2010 11:29:42 +0200
Subject: [PATCH] Fix vhost_net compilation errors for i386-softmmu target
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Hi,
there were compilation errors when I was trying to compile i386-softmmu target on i386 host (running on Fedora-13 with development version of qemu downloaded from git).

There were errors of comparison of unsigned expression was always true which made it unable to compile. This simple fix fixes the issue.

...
cc1: warnings being treated as errors
.../hw/vhost_net.c: In function ‘vhost_net_start’:
.../vhost_net.c:154: error: comparison of unsigned expression >= 0 is always true make[1]: *** [vhost_net.o] Error 1
make: *** [subdir-i386-softmmu] Error 2

---
 hw/vhost_net.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/vhost_net.c +1 -1
index 4a7b819..6958712 100644
@@ -151,7 +151,7 @@ int vhost_net_start(struct vhost_net *net,
     return 0;
 fail:
     file.fd = -1;
-    while (--file.index >= 0) {
+    while (--file.index > 0) {
         int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file);
         assert(r >= 0);
     }
Signature · 1 line
1.7.2.3
#1 lore raw
Quoted 18 lines · Michal Novotny

Hi,
there were compilation errors when I was trying to compile i386-softmmu target on i386
host (running on Fedora-13 with development version of qemu downloaded from git).

There were errors of comparison of unsigned expression was always true which made it
unable to compile. This simple fix fixes the issue.

...
cc1: warnings being treated as errors .../hw/vhost_net.c: In function ‘vhost_net_start’:
.../vhost_net.c:154: error: comparison of unsigned expression >= 0 is always true
make[1]: *** [vhost_net.o] Error 1
make: *** [subdir-i386-softmmu] Error 2

Quoted 6 lines
Signature · 2 lines
Michal Novotny<[email protected]>, RHCE
Virtualization Team (xen userspace), Red Hat

This is not the right fix though. I have queued the correct one on my tree, will send pull request.

Quoted 43 lines
Quoted 1 line

From 21dd405dbc871c8d0053cc68f8862665dc12f69a Mon Sep 17 00:00:00 2001

From: Michal Novotny <[email protected]>
Date: Mon, 20 Sep 2010 11:29:42 +0200
Subject: [PATCH] Fix vhost_net compilation errors for i386-softmmu target
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Hi,
there were compilation errors when I was trying to compile i386-softmmu target on i386 host (running on Fedora-13 with development version of qemu downloaded from git).

There were errors of comparison of unsigned expression was always true which made it unable to compile. This simple fix fixes the issue.

...
cc1: warnings being treated as errors
.../hw/vhost_net.c: In function ???vhost_net_start???:
.../vhost_net.c:154: error: comparison of unsigned expression >= 0 is always true make[1]: *** [vhost_net.o] Error 1
make: *** [subdir-i386-softmmu] Error 2

---
 hw/vhost_net.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/vhost_net.c +1 -1
index 4a7b819..6958712 100644
@@ -151,7 +151,7 @@ int vhost_net_start(struct vhost_net *net,
     return 0;
 fail:
     file.fd = -1;
-    while (--file.index >= 0) {
+    while (--file.index > 0) {
         int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file);
         assert(r >= 0);
     }
Signature · 1 line
1.7.2.3
#3 lore raw
In reply to Michal Novotny
Quoted 18 lines · Michal Novotny

Hi,
there were compilation errors when I was trying to compile i386-softmmu target on i386
host (running on Fedora-13 with development version of qemu downloaded from git).

There were errors of comparison of unsigned expression was always true which made it
unable to compile. This simple fix fixes the issue.

...
cc1: warnings being treated as errors
.../hw/vhost_net.c: In function ‘vhost_net_start’:
.../vhost_net.c:154: error: comparison of unsigned expression >= 0 is always true
make[1]: *** [vhost_net.o] Error 1
make: *** [subdir-i386-softmmu] Error 2

Quoted 1 line

I don't think the patch is correct. It looks like zero is a valid value for file.index, changing the check means that the ioctl is not performed for case file.index == 0.

The preincrements and predecrements seem suspicious.

#2 lore raw
In reply to Michael S. Tsirkin
Quoted 22 lines · Michael S. Tsirkin
Quoted 20 lines · Michal Novotny

Hi,
there were compilation errors when I was trying to compile i386-softmmu target on i386
host (running on Fedora-13 with development version of qemu downloaded from git).

There were errors of comparison of unsigned expression was always true which made it
unable to compile. This simple fix fixes the issue.

...
cc1: warnings being treated as errors .../hw/vhost_net.c: In function ‘vhost_net_start’:
.../vhost_net.c:154: error: comparison of unsigned expression>= 0 is always true
make[1]: *** [vhost_net.o] Error 1
make: *** [subdir-i386-softmmu] Error 2

Quoted 9 lines
Quoted 5 lines
Signature · 2 lines
Michal Novotny<[email protected]>, RHCE
Virtualization Team (xen userspace), Red Hat

This is not the right fix though. I have queued the correct one on my tree, will send pull request.

Oh, ok. Nevertheless according to the definition of file.index to be unsigned it can never be negative value so that's why I implemented the check against greater than zero rather than equal or greater than zero but maybe that's not the right way to fix it like you say. However, since your patch is already in the queue as you told me it's fine.

Michal

Signature · 2 lines
Michal Novotny<[email protected]>, RHCE
Virtualization Team (xen userspace), Red Hat