public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] tools: env: fix config file loading in env library
@ 2016-04-29 20:00 Anatolij Gustschin
  2016-05-02 23:32 ` [U-Boot] " Tom Rini
  2016-05-04 13:25 ` [U-Boot] [PATCH] " Stefano Babic
  0 siblings, 2 replies; 3+ messages in thread
From: Anatolij Gustschin @ 2016-04-29 20:00 UTC (permalink / raw)
  To: u-boot

env library is broken as the config file pointer is only initialized
in main(). When running in the env library parse_config() fails:

  Cannot parse config file '(null)': Bad address

Ensure that config file pointer is always initialized.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
---
 tools/env/fw_env.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 1420ac5..06cf63d 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -1325,6 +1325,9 @@ static int parse_config ()
 	struct stat st;
 
 #if defined(CONFIG_FILE)
+	if (!common_args.config_file)
+		common_args.config_file = CONFIG_FILE;
+
 	/* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */
 	if (get_config(common_args.config_file)) {
 		fprintf(stderr, "Cannot parse config file '%s': %m\n",
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [U-Boot] tools: env: fix config file loading in env library
  2016-04-29 20:00 [U-Boot] [PATCH] tools: env: fix config file loading in env library Anatolij Gustschin
@ 2016-05-02 23:32 ` Tom Rini
  2016-05-04 13:25 ` [U-Boot] [PATCH] " Stefano Babic
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Rini @ 2016-05-02 23:32 UTC (permalink / raw)
  To: u-boot

On Fri, Apr 29, 2016 at 10:00:11PM +0200, Anatolij Gustschin wrote:

> env library is broken as the config file pointer is only initialized
> in main(). When running in the env library parse_config() fails:
> 
>   Cannot parse config file '(null)': Bad address
> 
> Ensure that config file pointer is always initialized.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160502/f1a99cfc/attachment.sig>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] [PATCH] tools: env: fix config file loading in env library
  2016-04-29 20:00 [U-Boot] [PATCH] tools: env: fix config file loading in env library Anatolij Gustschin
  2016-05-02 23:32 ` [U-Boot] " Tom Rini
@ 2016-05-04 13:25 ` Stefano Babic
  1 sibling, 0 replies; 3+ messages in thread
From: Stefano Babic @ 2016-05-04 13:25 UTC (permalink / raw)
  To: u-boot

On 29/04/2016 22:00, Anatolij Gustschin wrote:
> env library is broken as the config file pointer is only initialized
> in main(). When running in the env library parse_config() fails:
> 
>   Cannot parse config file '(null)': Bad address
> 
> Ensure that config file pointer is always initialized.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
>  tools/env/fw_env.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
> index 1420ac5..06cf63d 100644
> --- a/tools/env/fw_env.c
> +++ b/tools/env/fw_env.c
> @@ -1325,6 +1325,9 @@ static int parse_config ()
>  	struct stat st;
>  
>  #if defined(CONFIG_FILE)
> +	if (!common_args.config_file)
> +		common_args.config_file = CONFIG_FILE;
> +
>  	/* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */
>  	if (get_config(common_args.config_file)) {
>  		fprintf(stderr, "Cannot parse config file '%s': %m\n",
> 

Reviewed-by : Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-04 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-29 20:00 [U-Boot] [PATCH] tools: env: fix config file loading in env library Anatolij Gustschin
2016-05-02 23:32 ` [U-Boot] " Tom Rini
2016-05-04 13:25 ` [U-Boot] [PATCH] " Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox