From d045cbacf2529266bb312add023e12c0d400bf67 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 7 Jul 2020 20:51:39 +0200 Subject: env: Add support for explicit write access list This option marks any U-Boot variable which does not have explicit 'w' writeable flag set as read-only. This way the environment can be locked down and only variables explicitly configured to be writeable can ever be changed by either 'env import', 'env set' or loading user environment from environment storage. Signed-off-by: Marek Vasut Reviewed-by: Tom Rini --- lib/hashtable.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/hashtable.c b/lib/hashtable.c index ef834badc52..4a8c50b4b8a 100644 --- a/lib/hashtable.c +++ b/lib/hashtable.c @@ -950,9 +950,12 @@ int himport_r(struct hsearch_data *htab, e.data = value; hsearch_r(e, ENV_ENTER, &rv, htab, flag); - if (rv == NULL) +#if !CONFIG_IS_ENABLED(ENV_WRITEABLE_LIST) + if (rv == NULL) { printf("himport_r: can't insert \"%s=%s\" into hash table\n", name, value); + } +#endif debug("INSERT: table %p, filled %d/%d rv %p ==> name=\"%s\" value=\"%s\"\n", htab, htab->filled, htab->size, -- cgit v1.2.3