summaryrefslogtreecommitdiff
path: root/lib/hashtable.c
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2020-07-07 20:51:39 +0200
committerTom Rini <trini@konsulko.com>2020-07-31 10:13:00 -0400
commitd045cbacf2529266bb312add023e12c0d400bf67 (patch)
tree1ce79c821d8045d76694786bfabb37aaf1bc12ea /lib/hashtable.c
parent47f3b1f243acfe755340753c5d467ba781618fa6 (diff)
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 <marex@denx.de> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'lib/hashtable.c')
-rw-r--r--lib/hashtable.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/hashtable.c b/lib/hashtable.c
index ef834badc5..4a8c50b4b8 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,