提交 78b2de80 编写于 作者: S Stephen Warren 提交者: Tom Rini

env_nand: fix incorrect size parameter to ALLOC_CACHE_ALIGN_BUFFER

The third parameter to ALLOC_CACHE_ALIGN_BUFFER is not size (as named),
but rather count (number of elements of the type to allocate). The
current code ends up allocating one copy of env_t for each byte in its
size, which quite possibly ends up overflowing RAM.

This fixes a bug in commit 3801a15f "env_nand: align NAND buffers".
Reported-by: NPrabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: NStephen Warren <swarren@nvidia.com>
Reported-by: NPrabhakar Lad <prabhakar.lad@ti.com>
上级 535c74f8
......@@ -226,7 +226,7 @@ int saveenv(void)
int saveenv(void)
{
int ret = 0;
ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));
ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
ssize_t len;
char *res;
nand_erase_options_t nand_erase_options;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册