discover/platforms: Fix param_list talloc failure
authorGeoff Levand <geoff@infradead.org>
Wed, 8 Aug 2018 00:01:10 +0000 (00:01 +0000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Tue, 14 Aug 2018 01:10:29 +0000 (11:10 +1000)
Signed-off-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
discover/platform-arm64.c
discover/platform-powerpc.c

index 9cd66410866a24d25247ef3976fac53fd2200a90..a70298a1ad8d6ff5c27e34dfd5ac3c2122c8a100 100644 (file)
@@ -39,7 +39,7 @@
 static const char *efi_vars_guid = "fb78ab4b-bd43-41a0-99a2-4e74bef9169b";
 
 struct platform_arm64 {
-       struct param_list params;
+       struct param_list *params;
        struct ipmi *ipmi;
 };
 
@@ -103,7 +103,7 @@ static void get_active_consoles(struct config *config)
 
 static int load_config(struct platform *p, struct config *config)
 {
-       struct param_list *pl = &to_platform_arm64(p)->params;
+       struct param_list *pl = to_platform_arm64(p)->params;
 
        parse_nvram(pl);
        config_populate_all(config, pl);
@@ -221,7 +221,7 @@ static void params_update_all(struct param_list *pl,
 
 static int save_config(struct platform *p, struct config *config)
 {
-       struct param_list *pl = &to_platform_arm64(p)->params;
+       struct param_list *pl = to_platform_arm64(p)->params;
        struct config *defaults;
 
        defaults = talloc_zero(NULL, struct config);
@@ -259,7 +259,8 @@ static bool probe(struct platform *p, void *ctx)
        }
 
        platform = talloc_zero(ctx, struct platform_arm64);
-       param_list_init(&platform->params, common_known_params());
+       platform->params = talloc_zero(platform, struct param_list);
+       param_list_init(platform->params, common_known_params());
 
        p->platform_data = platform;
 
index 84e18ccca5c51e73edc93585cbefe1a30b822598..2929077edd7784b4ec980422e2ba214dbc9fed18 100644 (file)
@@ -25,7 +25,7 @@ static const char *sysparams_dir = "/sys/firmware/opal/sysparams/";
 static const char *devtree_dir = "/proc/device-tree/";
 
 struct platform_powerpc {
-       struct param_list params;
+       struct param_list *params;
        struct ipmi     *ipmi;
        bool            ipmi_bootdev_persistent;
        int             (*get_ipmi_bootdev)(
@@ -89,13 +89,13 @@ static int parse_nvram_params(struct platform_powerpc *platform,
                if (namelen == 0)
                        continue;
 
-               if (!param_list_is_known_n(&platform->params, name, namelen))
+               if (!param_list_is_known_n(platform->params, name, namelen))
                        continue;
 
                *value = '\0';
                value++;
 
-               param_list_set(&platform->params, name, value, false);
+               param_list_set(platform->params, name, value, false);
        }
 
        return 0;
@@ -145,7 +145,7 @@ static int write_nvram(struct platform_powerpc *platform)
        process->path = "nvram";
        process->argv = argv;
 
-       param_list_for_each(&platform->params, param) {
+       param_list_for_each(platform->params, param) {
                char *paramstr;
 
                if (!param->modified)
@@ -562,7 +562,7 @@ static void get_ipmi_network_override(struct platform_powerpc *platform,
 
        if (!rc && persistent) {
                /* Write this new config to NVRAM */
-               params_update_network_values(&platform->params,
+               params_update_network_values(platform->params,
                        "petitboot,network", config);
                rc = write_nvram(platform);
                if (rc)
@@ -612,7 +612,7 @@ static int load_config(struct platform *p, struct config *config)
        if (rc)
                pb_log_fn("Failed to parse nvram\n");
 
-       config_populate_all(config, &platform->params);
+       config_populate_all(config, platform->params);
 
        if (platform->get_ipmi_bootdev) {
                bool bootdev_persistent;
@@ -649,7 +649,7 @@ static int save_config(struct platform *p, struct config *config)
        defaults = talloc_zero(platform, struct config);
        config_set_defaults(defaults);
 
-       params_update_all(&platform->params, config, defaults);
+       params_update_all(platform->params, config, defaults);
 
        talloc_free(defaults);
        return write_nvram(platform);
@@ -713,7 +713,8 @@ static bool probe(struct platform *p, void *ctx)
                return false;
 
        platform = talloc_zero(ctx, struct platform_powerpc);
-       param_list_init(&platform->params, common_known_params());
+       platform->params = talloc_zero(platform, struct param_list);
+       param_list_init(platform->params, common_known_params());
 
        p->platform_data = platform;