[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 5/9] qemu-xen-dir: virtio-rng: fix check for period_ms validity



From: "Luis R. Rodriguez" <mcgrof@xxxxxxxx>

Upstream fix a3a292c420d2 ("virtio-rng: fix check for period_ms validity")

On this upstream commit Amit fixed the compilation warning:

hw/virtio/virtio-rng.c: In function âvirtio_rng_device_realizeâ:
hw/virtio/virtio-rng.c:152:31: error: logical not is only applied to the
left hand side of comparison [-Werror=logical-not-parentheses]
     if (!vrng->conf.period_ms > 0) {

This ports that fix over. Note that the impact of not having this is
that the rng->conf.period_ms was set to 0 this can go undetected. Note
that period_ms is a uint32_t so it cannot be negative anyway.

Cc: Amit Shah <amit.shah@xxxxxxxxxx>
Cc: Gonglei <arei.gonglei@xxxxxxxxxx>
Amos Kong <akong@xxxxxxxxxx>
Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxx>
---
 hw/virtio/virtio-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index 473c04410e9e..06e71782b2d1 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -149,7 +149,7 @@ static void virtio_rng_device_realize(DeviceState *dev, 
Error **errp)
     VirtIORNG *vrng = VIRTIO_RNG(dev);
     Error *local_err = NULL;
 
-    if (!vrng->conf.period_ms > 0) {
+    if (vrng->conf.period_ms <= 0) {
         error_setg(errp, "'period' parameter expects a positive integer");
         return;
     }
-- 
2.6.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.