public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] env_ubi.c: Correct pointer error in env load
@ 2015-10-23 17:51 Kevin Smith
  2015-10-23 20:30 ` Joe Hershberger
  2015-10-26  5:06 ` Heiko Schocher
  0 siblings, 2 replies; 3+ messages in thread
From: Kevin Smith @ 2015-10-23 17:51 UTC (permalink / raw)
  To: u-boot

The variable "buf" in this function is a char array, and the
function ubi_volume_read is expecting a char *.  In the call, the
address of the pointer is being taken, incorrectly passing a
char **.  The compiler warning was being silenced by the cast.
Remove the address operator and the cast.

Signed-off-by: Kevin Smith <kevin.smith@elecsyscorp.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Tom Rini <trini@konsulko.com>
---
 common/env_ubi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/common/env_ubi.c b/common/env_ubi.c
index e0dc5af..e611199 100644
--- a/common/env_ubi.c
+++ b/common/env_ubi.c
@@ -181,8 +181,7 @@ void env_relocate_spec(void)
 		return;
 	}
 
-	if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)&buf,
-			    CONFIG_ENV_SIZE)) {
+	if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, buf, CONFIG_ENV_SIZE)) {
 		printf("\n** Unable to read env from %s:%s **\n",
 		       CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
 		set_default_env(NULL);
-- 
2.4.6

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

* [U-Boot] [PATCH] env_ubi.c: Correct pointer error in env load
  2015-10-23 17:51 [U-Boot] [PATCH] env_ubi.c: Correct pointer error in env load Kevin Smith
@ 2015-10-23 20:30 ` Joe Hershberger
  2015-10-26  5:06 ` Heiko Schocher
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Hershberger @ 2015-10-23 20:30 UTC (permalink / raw)
  To: u-boot

On Fri, Oct 23, 2015 at 12:51 PM, Kevin Smith
<kevin.smith@elecsyscorp.com> wrote:
> The variable "buf" in this function is a char array, and the
> function ubi_volume_read is expecting a char *.  In the call, the
> address of the pointer is being taken, incorrectly passing a
> char **.  The compiler warning was being silenced by the cast.
> Remove the address operator and the cast.
>
> Signed-off-by: Kevin Smith <kevin.smith@elecsyscorp.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Tom Rini <trini@konsulko.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

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

* [U-Boot] [PATCH] env_ubi.c: Correct pointer error in env load
  2015-10-23 17:51 [U-Boot] [PATCH] env_ubi.c: Correct pointer error in env load Kevin Smith
  2015-10-23 20:30 ` Joe Hershberger
@ 2015-10-26  5:06 ` Heiko Schocher
  1 sibling, 0 replies; 3+ messages in thread
From: Heiko Schocher @ 2015-10-26  5:06 UTC (permalink / raw)
  To: u-boot

Hello Kevin,

Am 23.10.2015 um 19:51 schrieb Kevin Smith:
> The variable "buf" in this function is a char array, and the
> function ubi_volume_read is expecting a char *.  In the call, the
> address of the pointer is being taken, incorrectly passing a
> char **.  The compiler warning was being silenced by the cast.
> Remove the address operator and the cast.
>
> Signed-off-by: Kevin Smith <kevin.smith@elecsyscorp.com>
> Cc: Joe Hershberger <joe.hershberger@ni.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
>   common/env_ubi.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/common/env_ubi.c b/common/env_ubi.c
> index e0dc5af..e611199 100644
> --- a/common/env_ubi.c
> +++ b/common/env_ubi.c
> @@ -181,8 +181,7 @@ void env_relocate_spec(void)
>   		return;
>   	}
>
> -	if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, (void *)&buf,
> -			    CONFIG_ENV_SIZE)) {
> +	if (ubi_volume_read(CONFIG_ENV_UBI_VOLUME, buf, CONFIG_ENV_SIZE)) {
>   		printf("\n** Unable to read env from %s:%s **\n",
>   		       CONFIG_ENV_UBI_PART, CONFIG_ENV_UBI_VOLUME);
>   		set_default_env(NULL);

Good catch!

Reviewed-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

end of thread, other threads:[~2015-10-26  5:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-23 17:51 [U-Boot] [PATCH] env_ubi.c: Correct pointer error in env load Kevin Smith
2015-10-23 20:30 ` Joe Hershberger
2015-10-26  5:06 ` Heiko Schocher

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