diff options
author | Andrey Pronin <apronin@chromium.org> | 2019-09-27 15:27:37 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-10-04 20:56:44 +0000 |
commit | 8edcc006fe29232e764a717ce40588aa0cf8b226 (patch) | |
tree | 021aa9a57136ee00cf0d424aa1129bfc37a2aa54 | |
parent | a5fff11e30bad889ce14d35ef9015781e1dc0a83 (diff) | |
download | chrome-ec-8edcc006fe29232e764a717ce40588aa0cf8b226.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>
(cherry picked from commit 831d113c640edbc2a63cd03436a840b0688beab8)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1835038
Tested-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Vadim Bendebury <vbendeb@chromium.org>
(cherry picked from commit 5a39159782e3becc83a4585cea7ed21a557677ad)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1838876
-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; } |