[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v6 04/15] x86: add multiboot2 protocol support



On Mon, Sep 19, 2016 at 05:42:36AM -0600, Jan Beulich wrote:
> >>> On 12.09.16 at 22:18, <daniel.kiper@xxxxxxxxxx> wrote:

[...]

> > +        case MULTIBOOT2_TAG_TYPE_MODULE:
> > +            if ( mod_idx >= mbi_out->mods_count )
> > +                break;
> > +
> > +            mbi_out_mods[mod_idx].mod_start = get_mb2_data(tag, module, 
> > mod_start);
> > +            mbi_out_mods[mod_idx].mod_end = get_mb2_data(tag, module, 
> > mod_end);
> > +            ptr = get_mb2_string(tag, module, cmdline);
> > +            mbi_out_mods[mod_idx].string = copy_string(ptr);
>
> How is no (or an empty) command line being represented? Surely
> you could avoid allocation and copying in that case? And should it be
> possible for the cmdline field to be zero, you'd definitely have to
> avoid it.

copy_string() returns 0 if ptr is 0. If string pointed by ptr is empty
(just contains '\0') copy_string() returns pointer to empty string.
Potentially we can optimize copy_string() and return 0 if ptr points
to empty string. However, I do not think it does make sense.

Daniel

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.