diff options
author | Andrey Pronin <apronin@chromium.org> | 2019-09-27 15:27:37 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-01 06:18:39 +0000 |
commit | 831d113c640edbc2a63cd03436a840b0688beab8 (patch) | |
tree | 6ca42c76da54d85fafc0305d56d5e107d010ee30 | |
parent | f5afc5c7773123e397161c7decc03aeaf38b26f6 (diff) | |
download | chrome-ec-831d113c640edbc2a63cd03436a840b0688beab8.tar.gz |
cr50: nvmem: fix total vars overflow check
Before this CL, when changing an already existing variable, setvar_()
was ensuring that the new size of *all* variables is smaller than the
limit for one variable. This CL fixes the check: now it checks that the
new size of all variables is smaller than the total variables size
limit.
BRANCH=none
BUG=b:141774726
TEST=running test_nvmem with CL:1828184 applied doesn't lead to
overflows in setvar.
Change-Id: Icc70d728a2d6986d98b686980081e1cbba132195
Signed-off-by: Andrey Pronin <apronin@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1829292
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Jason Clinton <jclinton@chromium.org>
-rw-r--r-- | common/new_nvmem.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/new_nvmem.c b/common/new_nvmem.c index e61021e3c3..58b9b46117 100644 --- a/common/new_nvmem.c +++ b/common/new_nvmem.c @@ -2934,7 +2934,7 @@ static int setvar_(const uint8_t *key, uint8_t key_len, const uint8_t *val, if ((old_var_space < new_var_space) && ((total_var_space + new_var_space - old_var_space) > - MAX_VAR_BODY_SPACE)) { + MAX_VAR_TOTAL_SPACE)) { shared_mem_release(vc); return EC_ERROR_OVERFLOW; } |