All of lore.kernel.org
 help / color / mirror / Atom feed
From: Norbert Manthey <nmanthey@amazon.com>
To: xen-devel@lists.xen.org
Cc: Norbert Manthey <nmanthey@amazon.com>
Subject: [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup
Date: Fri, 17 Feb 2017 11:47:46 +0100	[thread overview]
Message-ID: <1487328466-19180-3-git-send-email-nmanthey@amazon.com> (raw)
In-Reply-To: <1487328466-19180-1-git-send-email-nmanthey@amazon.com>

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>
---
 tools/misc/xen-lowmemd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/misc/xen-lowmemd.c b/tools/misc/xen-lowmemd.c
index 3200404..865a54c 100644
--- a/tools/misc/xen-lowmemd.c
+++ b/tools/misc/xen-lowmemd.c
@@ -10,14 +10,14 @@
 #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);
-- 
2.7.4


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

  parent reply	other threads:[~2017-02-17 10:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-17 10:47 (no subject) Norbert Manthey
2017-02-17 10:47 ` [MINOR FIXES 1/2] mm: fix memory cleanup Norbert Manthey
2017-02-17 11:29   ` Andrew Cooper
2017-02-17 10:47 ` Norbert Manthey [this message]
2017-02-17 11:31   ` [MINOR FIXES 2/2] lowmemd: fix comparison in cleanup Andrew Cooper
2017-02-20 16:58     ` Wei Liu
2017-02-20 19:19       ` Norbert Manthey
2017-02-20 20:10         ` Wei Liu
2017-02-17 11:35 ` (no subject) Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487328466-19180-3-git-send-email-nmanthey@amazon.com \
    --to=nmanthey@amazon.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.