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] [PATCH] Check for NULL source pointer

To: Amos Waterland <apw@xxxxxxxxxx>
Subject: Re: [XenPPC] [PATCH] Check for NULL source pointer
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Wed, 28 Mar 2007 09:54:33 -0500
Cc: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 28 Mar 2007 07:53:37 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <20070327231845.GA17430@xxxxxxxxxx>
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: <20070327231845.GA17430@xxxxxxxxxx>
Reply-to: Hollis Blanchard <hollisb@xxxxxxxxxx>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Tue, 2007-03-27 at 19:18 -0400, Amos Waterland wrote:
> While debugging the zImage problem on a JS21, I noticed that DOM0
> bootargs was filled with bogus characters.  I believe something like
> this is necessary.
> 
> Signed-off-by: Amos Waterland <apw@xxxxxxxxxx>
> 
> ---
> 
>  ofd_fixup.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff -r cc72b77132f9 xen/arch/powerpc/ofd_fixup.c
> --- a/xen/arch/powerpc/ofd_fixup.c    Wed Mar 21 18:29:49 2007 -0500
> +++ b/xen/arch/powerpc/ofd_fixup.c    Tue Mar 27 19:13:03 2007 -0400
> @@ -276,7 +276,10 @@ static ofdn_t ofd_chosen_props(void *m, 
>                       &path[1], sizeof (path) - 1);
>      }
> 
> -    strlcpy(bootargs, cmdline, sizeof(bootargs));
> +    memset(bootargs, 0, sizeof(bootargs));
> +    if (cmdline) {
> +        strlcpy(bootargs, cmdline, sizeof(bootargs));
> +    }
>      bsz = strlen(bootargs) + 1;
>      rm = sizeof (bootargs) - bsz;

Scary, it looks like we're doing strlen(NULL) in strlcpy(), which must
be returning a non-0 length (since the memory at 0 actually contains
instructions).

Nice catch, thanks.

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