env: correct overflow check of env_has_init size
PATCH 1/1 env: correct overflow check of env_has_init size
Correct the overflow check of the bit-field env_has_init with the max value of env_location= ENVL_COUNT and no more with the size of env_locations.
This bit-field is indexed by this enumerate and not by the position in the env_locations (only used in env_get_location) and the
2 values are different, depending of thea ctivated CONFIG_ENV_IS_ options.
---
env/env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
env/env.c +1 -1
@@ -103,7 +103,7 @@ static void env_set_inited(enum env_location location)* using the above enum value as the bit index. We need to * make sure that we're not overflowing it. */ -BUILD_BUG_ON (ARRAY_SIZE (env_locations) >BITS_PER_LONG ); +BUILD_BUG_ON (ENVL_COUNT >BITS_PER_LONG ); gd->env_has_init |=BIT (location); }
Signature · 1 line
2.17.1
PATCH 1/1 env: correct overflow check of env_has_init size
Quoted 9 lines · Patrick Delaunay
Correct the overflow check of the bit-field
env_has_initwith the max value of env_location=ENVL_COUNTand no more with the size ofenv_locations.This bit-field is indexed by this enumerate and not by the position in the
env_locations(only used inenv_get_location) and the
2 values are different, depending of thea ctivatedCONFIG_ENV_IS_options.Signed-off-by Patrick Delaunay <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200727/ce61b6b2/attachment.sig>