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-ppc-devel

Re: [XenPPC] [rfc][linux] xencomm encapsulates a NULL pointer

To: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
Subject: Re: [XenPPC] [rfc][linux] xencomm encapsulates a NULL pointer
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Wed, 12 Jul 2006 12:28:21 -0500
Cc: xen-ppc-devel <xen-ppc-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 12 Jul 2006 10:28:04 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <E05198B1-E714-4593-A72F-03F4E25D0D8B@xxxxxxxxxxxxxx>
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: IBM Linux Technology Center
References: <E05198B1-E714-4593-A72F-03F4E25D0D8B@xxxxxxxxxxxxxx>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Wed, 2006-07-12 at 00:18 -0400, Jimi Xenidis wrote:
> sometimes the xencomm logic is passed a NULL pointer which is a valid  
> value.
>
> Since the check for NULL is done with:
>    #define guest_handle_is_null(hnd)        ((hnd).p == NULL)
> 
> I figure we should still initialize but mark all array entires as  
> invalid.
> The follow patch should do the trick.
> comments?
> -JX
> 
> diff -r 72c8bc5d88f4 drivers/xen/core/xencomm.c
> --- a/drivers/xen/core/xencomm.c      Thu Jun 29 13:04:30 2006 -0400
> +++ b/drivers/xen/core/xencomm.c      Wed Jul 12 00:15:56 2006 -0400
> @@ -60,7 +60,7 @@ static int __xencomm_init(struct xencomm
>       int i = 0;
>       /* record the physical pages used */
> -     while ((recorded < bytes) && (i < desc->nr_addrs)) {
> +     while (buffer && (recorded < bytes) && (i < desc->nr_addrs)) {
>               unsigned long vaddr = (unsigned long)buffer + recorded;
>               unsigned long paddr;
>               int offset;

Shouldn't 'bytes' be 0 in the case of a NULL pointer? In that case, I
think this code should already work?

-- 
Hollis Blanchard
IBM Linux Technology Center


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

<Prev in Thread] Current Thread [Next in Thread>