]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
lowmemd: fix comparison in cleanup
authorNorbert Manthey <nmanthey@amazon.com>
Fri, 17 Feb 2017 10:47:46 +0000 (11:47 +0100)
committerWei Liu <wei.liu2@citrix.com>
Mon, 20 Feb 2017 16:55:24 +0000 (16:55 +0000)
The variable virq_port of type uint32_t was compared to being greater than
-1. This check always results in false for unsigned data types, resulting
in never cleaning up the memory. Furthermore, the initialization with a
negative variable for an unsigned type has been fixed.

Signed-off-by: Norbert Manthey <nmanthey@amazon.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
tools/misc/xen-lowmemd.c

index 32004049a14dde157177b6f3421e979e1e69ee62..865a54cec1830601b1871dbe3cedc63ef2c9565e 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-static evtchn_port_t virq_port      = -1;
+static evtchn_port_t virq_port      = ~0;
 static xenevtchn_handle *xce_handle = NULL;
 static xc_interface *xch            = NULL;
 static struct xs_handle *xs_handle  = NULL;
 
 void cleanup(void)
 {
-    if (virq_port > -1)
+    if (virq_port != ~0)
         xenevtchn_unbind(xce_handle, virq_port);
     if (xce_handle)
         xenevtchn_close(xce_handle);