Re: [PATCH v5 10/10] x86, efi: EFI boot stub support

From: Matt Fleming
Date: Mon Oct 17 2011 - 14:28:23 EST


On Mon, 2011-10-17 at 18:39 +0200, Maarten Lankhorst wrote:
> > + if (options_size) {
> > + if (options_size > hdr->cmdline_size)
> > + options_size = hdr->cmdline_size;
> > +
> > + options_size++; /* NUL termination */
> > +
> > + status = low_alloc(options_size, 1, &cmdline);
> > + if (status != EFI_SUCCESS)
> > + goto fail;
> Shouldn't this be options_size + 1?

Nope. Notice the options_size++ above the allocation.

> > +
> > + s1 = (u8 *)(unsigned long)cmdline;
> > + s2 = (u16 *)options;
> > +
> > + for (i = 0; i < options_size - 1; i++)
> > + *s1++ = *s2++;

And the options_size - 1 here.

> > +
> > + *s1 = '\0';
> For this null character..

So this should all work OK.

--
Matt Fleming, Intel Open Source Technology Center

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/