[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XenPPC] [PATCH] Check for NULL source pointer
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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |