From: "Luis R. Rodriguez" <mcg...@suse.com>

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.s...@redhat.com>
Cc: Gonglei <arei.gong...@huawei.com>
Amos Kong <ak...@redhat.com>
Signed-off-by: Luis R. Rodriguez <mcg...@suse.com>
---
 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@lists.xen.org
http://lists.xen.org/xen-devel

Reply via email to