From: Christoph Egger Date: Tue, 29 May 2012 10:12:45 +0000 (+0100) Subject: xenstore: fix crash on platforms with no gntdev driver implementation. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ed19e69369f0ac593f2c0cba84159bcd86d23a07;p=people%2Fvhanquez%2Fxen-unstable.git xenstore: fix crash on platforms with no gntdev driver implementation. Fix pointer checks introduced in changeset 24757:aae516b78fce. Signed-off-by: Christoph Egger Acked-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Campbell --- diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index f8c822f46e..bf83d5830b 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -167,7 +167,7 @@ static int readchn(struct connection *conn, void *data, unsigned int len) static void *map_interface(domid_t domid, unsigned long mfn) { - if (*xcg_handle >= 0) { + if (*xcg_handle != NULL) { /* this is the preferred method */ return xc_gnttab_map_grant_ref(*xcg_handle, domid, GNTTAB_RESERVED_XENSTORE, PROT_READ|PROT_WRITE); @@ -179,7 +179,7 @@ static void *map_interface(domid_t domid, unsigned long mfn) static void unmap_interface(void *interface) { - if (*xcg_handle >= 0) + if (*xcg_handle != NULL) xc_gnttab_munmap(*xcg_handle, interface, 1); else munmap(interface, getpagesize());