diff mbox

[U-Boot] cmd_nvedit.c: make error message more helpful

Message ID 1304540989-10450-1-git-send-email-wd@denx.de
State Accepted
Commit a02a884b95c47e114a54f2751d03f139f312af2f
Headers show

Commit Message

Wolfgang Denk May 4, 2011, 8:29 p.m. UTC
When calling getenv_f() with a too small buffer, it would print an
error message like this:

	env_buf too small [32]

This is not really helpful as it does not give any indication which of
the calls might have failed.  Change this into:

	env_buf [32 bytes] too small for value of "hwconfig"

so we know at least which variable caused the overflow; this usually
allows to quickly find the related code as well.

Signed-off-by: Wolfgang Denk <wd@denx.de>
---
 common/cmd_nvedit.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Wolfgang Denk May 12, 2011, 5:47 p.m. UTC | #1
Dear Wolfgang Denk,

In message <1304540989-10450-1-git-send-email-wd@denx.de> you wrote:
> When calling getenv_f() with a too small buffer, it would print an
> error message like this:
> 
> 	env_buf too small [32]
> 
> This is not really helpful as it does not give any indication which of
> the calls might have failed.  Change this into:
> 
> 	env_buf [32 bytes] too small for value of "hwconfig"
> 
> so we know at least which variable caused the overflow; this usually
> allows to quickly find the related code as well.
> 
> Signed-off-by: Wolfgang Denk <wd@denx.de>
> ---
>  common/cmd_nvedit.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
diff mbox

Patch

diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index aa9de3a..b2c88ba 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -532,7 +532,8 @@  int getenv_f(char *name, char *buf, unsigned len)
 		if (n)
 			*--buf = '\0';
 
-		printf("env_buf too small [%d]\n", len);
+		printf("env_buf [%d bytes] too small for value of \"%s\"\n",
+			len, name);
 
 		return n;
 	}