diff mbox series

libuboot_env: fix calculation of usable envsize

Message ID 20201216154837.165589-1-sava.jakovljev@teufel.de
State Accepted
Headers show
Series libuboot_env: fix calculation of usable envsize | expand

Commit Message

Sava Jakovljev Dec. 16, 2020, 3:48 p.m. UTC
* Adjust calculated usable envsize in case redundand environment is used.

Signed-off-by: Sava Jakovljev <sava.jakovljev@teufel.de>
---
 src/uboot_env.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sava Jakovljev Jan. 10, 2021, 7:16 p.m. UTC | #1
Hello Stefano,

Any update on this patch?

Thank you.
Best regards,
Sava Jakovljev

On Wednesday, December 16, 2020 at 4:49:00 PM UTC+1 Sava Jakovljev wrote:

> * Adjust calculated usable envsize in case redundand environment is used.
>
> Signed-off-by: Sava Jakovljev <sava.ja...@teufel.de>
> ---
> src/uboot_env.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/uboot_env.c b/src/uboot_env.c
> index 577721c..a4c4c9b 100644
> --- a/src/uboot_env.c
> +++ b/src/uboot_env.c
> @@ -955,7 +955,6 @@ static int libuboot_load(struct uboot_ctx *ctx)
> struct var_entry *entry;
>
> ctx->valid = false;
> - usable_envsize = ctx->size - offsetdata;
>
> bufsize = ctx->size;
> if (ctx->redundant) {
> @@ -964,6 +963,7 @@ static int libuboot_load(struct uboot_ctx *ctx)
> offsetdata = offsetof(struct uboot_env_redund, data);
> offsetcrc = offsetof(struct uboot_env_redund, crc);
> }
> + usable_envsize = ctx->size - offsetdata;
> buf[0] = malloc(bufsize);
> if (!buf[0])
> return -ENOMEM;
>
Stefano Babic Jan. 11, 2021, 12:47 p.m. UTC | #2
On 10.01.21 20:16, Sava Jakovljev wrote:
> Hello Stefano,
> 
> Any update on this patch?

It seems ok to me.

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

Best regards,
Stefano Babic

> 
> Thank you.
> Best regards,
> Sava Jakovljev
> 
> On Wednesday, December 16, 2020 at 4:49:00 PM UTC+1 Sava Jakovljev wrote:
> 
>     * Adjust calculated usable envsize in case redundand environment is
>     used.
> 
>     Signed-off-by: Sava Jakovljev <sava.ja...@teufel.de>
>     ---
>     src/uboot_env.c | 2 +-
>     1 file changed, 1 insertion(+), 1 deletion(-)
> 
>     diff --git a/src/uboot_env.c b/src/uboot_env.c
>     index 577721c..a4c4c9b 100644
>     --- a/src/uboot_env.c
>     +++ b/src/uboot_env.c
>     @@ -955,7 +955,6 @@ static int libuboot_load(struct uboot_ctx *ctx)
>     struct var_entry *entry;
> 
>     ctx->valid = false;
>     - usable_envsize = ctx->size - offsetdata;
> 
>     bufsize = ctx->size;
>     if (ctx->redundant) {
>     @@ -964,6 +963,7 @@ static int libuboot_load(struct uboot_ctx *ctx)
>     offsetdata = offsetof(struct uboot_env_redund, data);
>     offsetcrc = offsetof(struct uboot_env_redund, crc);
>     }
>     + usable_envsize = ctx->size - offsetdata;
>     buf[0] = malloc(bufsize);
>     if (!buf[0])
>     return -ENOMEM;
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+unsubscribe@googlegroups.com
> <mailto:swupdate+unsubscribe@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/45fb5f30-21da-43dc-a1f7-1ade6e1f5773n%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/45fb5f30-21da-43dc-a1f7-1ade6e1f5773n%40googlegroups.com?utm_medium=email&utm_source=footer>.
diff mbox series

Patch

diff --git a/src/uboot_env.c b/src/uboot_env.c
index 577721c..a4c4c9b 100644
--- a/src/uboot_env.c
+++ b/src/uboot_env.c
@@ -955,7 +955,6 @@  static int libuboot_load(struct uboot_ctx *ctx)
 	struct var_entry *entry;
 
 	ctx->valid = false;
-	usable_envsize = ctx->size - offsetdata;
     
 	bufsize = ctx->size;
 	if (ctx->redundant) {
@@ -964,6 +963,7 @@  static int libuboot_load(struct uboot_ctx *ctx)
 		offsetdata = offsetof(struct uboot_env_redund, data);
 		offsetcrc = offsetof(struct uboot_env_redund, crc);
 	}
+	usable_envsize = ctx->size - offsetdata;
 	buf[0] = malloc(bufsize);
 	if (!buf[0])
 		return -ENOMEM;