[PATCH v2 23/30] discover/powerpc: Switch to new param_list
Samuel Mendoza-Jonas
sam at mendozajonas.com
Mon Aug 6 15:42:35 AEST 2018
On Thu, 2018-08-02 at 17:29 +0000, Geoff Levand wrote:
> Signed-off-by: Geoff Levand <geoff at infradead.org>
> ---
Hi Geoff,
<snip>
> static int parse_nvram_params(struct platform_powerpc *platform,
> char *buf, int len)
> {
> @@ -110,7 +74,6 @@ static int parse_nvram_params(struct platform_powerpc *platform,
>
> for (pos = buf + i; pos < buf + len; pos += paramlen + 1) {
> unsigned int namelen;
> - struct param *param;
> char *newline;
>
> newline = strchr(pos, '\n');
> @@ -130,16 +93,12 @@ static int parse_nvram_params(struct platform_powerpc *platform,
> if (namelen == 0)
> continue;
I noticed this while testing, since namelen doesn't get passed to
param_list_set() it accidentally uses the whole string, eg:
param_list_set: Created: auto-boot?=false:false
param_list_set: Created: petitboot,bootdevs=network any :network any
This could just be fixed up by doing..
>
> - if (!param_is_known(name, namelen))
> + if (!param_list_is_known_n(&platform->params, name, namelen))
> continue;
>
*value = '\0';
> value++;
Which I can fixup, does that sound right?
Cheers,
Sam
>
> - param = talloc(platform, struct param);
> - param->modified = false;
> - param->name = talloc_strndup(platform, name, namelen);
> - param->value = talloc_strdup(platform, value);
> - list_add(&platform->params, ¶m->list);
> + param_list_set(&platform->params, name, value, false);
> }
>
More information about the Petitboot
mailing list