summaryrefslogtreecommitdiff
path: root/common/env_flags.c
Commit message (Collapse)AuthorAgeLines
* tools: fix env_flags buildLubomir Rintel2016-02-15-0/+1
| | | | | | | | | | | | | | | | | $ make tools-all ... In file included from tools/env/env_flags.c:1:0: tools/env/../../common/env_flags.c: In function ‘env_flags_parse_varaccess_from_binflags’: tools/env/../../common/env_flags.c:156:18: warning: implicit declaration of function ‘ARRAY_SIZE’ [-Wimplicit-function-declaration] for (i = 0; i < ARRAY_SIZE(env_flags_varaccess_mask); i++) ^ Seems like the other utilities just add a copy of ARRAY_SIZE since there's nowhere to include it from (tools/imagetool.h, tools/mxsimage.h). Let's do the same here. Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
* tools: env validate: pass values as 0-based arrayAndreas Fenkart2016-02-08-7/+7
| | | | | | passing argv/argc can produce off-by-one errors Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
* common: env_flags: fix loop condition when using env_flags_varaccess_maskPeng Fan2016-01-13-1/+1
| | | | | | | | | | | | | | | We should use ARRAY_SIZE, but not sizeof. The size of env_flags_varaccess_mask is 16bytes, but we only need 4 loops. If using 16 as the end condition, we may access memory that not belong to array env_flags_varaccess_mask. Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: York Sun <yorksun@freescale.com> Cc: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
* common: env: initialize scalar variablePeng Fan2016-01-04-0/+1
| | | | | | | | | | | | | | | | Before calling hsearch_r, initialize callback entry to NULL. Coverity log: " Uninitialized scalar variable (UNINIT) uninit_use_in_call: Using uninitialized value e. Field e.callback is uninitialized when calling hsearch_r. " Reported-by: Coverity Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Tom Rini <trini@konsulko.com> Cc: Simon Glass <sjg@chromium.org>
* common/env_flags.c: Add function to validate a MAC addressCodrin Ciubotariu2015-09-21-13/+27
| | | | | | | | | | | | The code that checks if a string has the format of a MAC address has been moved to a separate function called eth_validate_ethaddr_str(). This has been done to allow other components (such as vsc9953 driver) to validate a MAC address. Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: York Sun <yorksun@freescale.com>
* env: Allow env_attr_walk to pass a priv * to callbackJoe Hershberger2015-05-21-3/+3
| | | | | | | | In some cases it can be helpful to have context in the callback about the calling situation. This is needed for following patches. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* common, env: optimize boottimeHeiko Schocher2014-01-14-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | when creating the hashtable, for each environmentvariable getenv(ENV_CALLBACK_VAR) and getenv(ENV_FLAGS_VAR) is called, which costs at this point a lot of time. So call this two getenv() calls only once. Boottime on the ids8313 board without this patch: 2013-12-19 13:38:22,894: NAND: 128 MiB 2013-12-19 13:38:27,659: In: serial (~4.8 sec) Bootime with this patch on the ids8313 board: 2013-12-19 13:40:25,332: NAND: 128 MiB 2013-12-19 13:40:25,546: In: serial (~0.2 sec) Signed-off-by: Heiko Schocher <hs@denx.de> Cc: Tom Rini <trini@ti.com> Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Wolfgang Denk <wd@denx.de>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-17/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* env: Handle write-once ethaddr and serial# genericallyJoe Hershberger2012-12-13-19/+0
| | | | | | | Use the variable access flags to implement the protection for ethaddr and serial# instead of hard-coding them. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add support for access control to .flagsJoe Hershberger2012-12-13-4/+155
| | | | | | Add support for read-only, write-once, and change-default. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add a command to display details about env flagsJoe Hershberger2012-12-13-0/+34
| | | | | | | Similar to the env callback command, this will show details about the options available, the static list, and the currently active variables. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* tools/env: Add environment variable flags supportJoe Hershberger2012-12-13-0/+75
| | | | | | | | | | | | | | Currently just validates variable types as decimal, hexidecimal, boolean, ip address, and mac address. Call env_acl_validate_setenv_params() from setenv() in fw_env.c. If the entry is not found in the env .flags, then look in the static one. This allows the env to override the static definitions, but prevents the need to have every definition in the environment distracting you. Need to build in _ctype for isdigit for Linux. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
* env: Add environment variable flagsJoe Hershberger2012-12-13-0/+319
Currently just validates variable types as decimal, hexidecimal, boolean, ip address, and mac address. If the entry is not found in the env ".flags", then look in the static one. This allows the env to override the static definitions, but prevents the need to have every definition in the environment distracting you. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>