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

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

To: "Yang, Xiaowei" <xiaowei.yang@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Pointer should be checked before use
From: Keir Fraser <Keir.Fraser@xxxxxxxxxxxx>
Date: Wed, 09 Jan 2008 08:38:15 +0000
Delivery-date: Wed, 09 Jan 2008 00:38:37 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <8C834404208B254EAD4E532C948598690135D10D@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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/aW0aeibQAJArM7
Thread-topic: [Xen-devel] [PATCH] Pointer should be checked before use
User-agent: Microsoft-Entourage/11.3.6.070618
Perhaps the caller should not pass NULL pointers?

 -- Keir

On 9/1/08 04:20, "Yang, Xiaowei" <xiaowei.yang@xxxxxxxxx> wrote:

> 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



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