summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2016-01-12 13:21:23 +0800
committerfang hui <hui.fang@freescale.com>2016-03-16 13:48:15 +0800
commit9a858ca40ab42d6a606027c23f2d6370cee57f83 (patch)
tree8b76b7b8d53a4a4d1113434047d5baaa6ad7a657 /common
parent38f1899fc2fd2d49d9781a8727a77b677be5fecb (diff)
downloadu-boot-imx-9a858ca40ab42d6a606027c23f2d6370cee57f83.zip
u-boot-imx-9a858ca40ab42d6a606027c23f2d6370cee57f83.tar.gz
u-boot-imx-9a858ca40ab42d6a606027c23f2d6370cee57f83.tar.bz2
MLK-12201 common: env: fix out of bounds read
We should use ARRAY_SIZE, but not directly sizeof, otherwise we may access memory that is not belong the array env_flags_varaccess_mask. Coverity ID: 17949 Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'common')
-rw-r--r--common/env_flags.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/env_flags.c b/common/env_flags.c
index 471973a..8e60384 100644
--- a/common/env_flags.c
+++ b/common/env_flags.c
@@ -152,7 +152,7 @@ enum env_flags_varaccess env_flags_parse_varaccess_from_binflags(int binflags)
{
int i;
- for (i = 0; i < sizeof(env_flags_varaccess_mask); i++)
+ for (i = 0; i < ARRAY_SIZE(env_flags_varaccess_mask); i++)
if (env_flags_varaccess_mask[i] ==
(binflags & ENV_FLAGS_VARACCESS_BIN_MASK))
return (enum env_flags_varaccess)i;