WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] Pointer should be checked before use

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Pointer should be checked before use
From: "Yang, Xiaowei" <xiaowei.yang@xxxxxxxxx>
Date: Wed, 9 Jan 2008 12:20:15 +0800
Delivery-date: Tue, 08 Jan 2008 20:24:06 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AchSdu8GfHuXbyKLR6KQN/aW0aeibQ==
Thread-topic: [PATCH] Pointer should be checked before use
Signed-off-by: Xiaowei Yang <xiaowei.yang@xxxxxxxxx>

diff -r c70d47b78f65 -r 89710484b825 tools/libxc/xc_linux.c
--- a/tools/libxc/xc_linux.c    Tue Jan 08 02:30:24 2008 +0800
+++ b/tools/libxc/xc_linux.c    Tue Jan 08 05:37:23 2008 +0800
@@ -472,7 +472,10 @@ void *xc_gnttab_map_grant_refs(int xcg_h
     struct ioctl_gntdev_map_grant_ref *map;
     void *addr = NULL;
     int i;
-
+
+    if ( domids == NULL || refs == NULL )
+        return NULL;
+
     map = malloc(sizeof(*map) +
                  (count-1) * sizeof(struct
ioctl_gntdev_map_grant_ref));
     if ( map == NULL )

Regards, 
Xiaowei 


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel