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. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
This commit is contained in:
parent
6731bef696
commit
d5a6a5a927
2
env/env.c
vendored
2
env/env.c
vendored
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user