[PATCH 14/14] env: Use static_assert() to check if default_environment is too large

Simon Glass sjg at chromium.org
Sun Oct 31 13:56:54 CET 2021


On Fri, 22 Oct 2021 at 07:48, Marek Behún <kabel at kernel.org> wrote:
>
> From: Marek Behún <marek.behun at nic.cz>
>
> Check sizeof(default_environment) against ENV_SIZE in a static_assert()
> instead of runtime.
> Only check if !USE_HOSTCC (for in fw_env tool ENV_SIZE expands to a
> variable, and cannot be checked statically) nad
> !DEFAULT_ENV_INSTANCE_EMBEDDED, for in that case the default_environment
> variable is not set.
>
> Signed-off-by: Marek Behún <marek.behun at nic.cz>
> ---
>  env/common.c          | 5 -----
>  include/env_default.h | 6 ++++++
>  2 files changed, 6 insertions(+), 5 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>

Applied to u-boot-dm, thanks!


More information about the U-Boot mailing list