diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2018-03-01 15:08:05 +0100 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-01 12:39:05 -0800 |
commit | f917f447d7206faa98ea2c1b1915fb4196913ef0 (patch) | |
tree | b3b21c55525af8a85fe8a0ff5012a044bdc76cc5 | |
parent | 73ed5a5a7841f8e944613deae5d12b68798bee9e (diff) | |
download | chrome-ec-f917f447d7206faa98ea2c1b1915fb4196913ef0.tar.gz |
fix shmem console command
The shmem console command was looping with the wrong iterators,
doing an infinite loop when there was more than one allocated or
free block.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=none
TEST=build software with CONFIG_MALLOC and CONFIG_CMD_SHMEM, then run
'shmem' on the console at different time without hitting watchdog reset.
Change-Id: I93a9cff3811669ab895fa8753d1571e90aeb4f33
Reviewed-on: https://chromium-review.googlesource.com/943070
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r-- | common/shmalloc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/shmalloc.c b/common/shmalloc.c index fc9fed16c7..071930b649 100644 --- a/common/shmalloc.c +++ b/common/shmalloc.c @@ -359,7 +359,7 @@ static int command_shmem(int argc, char **argv) mutex_lock(&shmem_lock); - for (buf = free_buf_chain; buf; buf = free_buf_chain->next_buffer) { + for (buf = free_buf_chain; buf; buf = buf->next_buffer) { size_t buf_room; buf_room = buf->buffer_size; @@ -370,7 +370,7 @@ static int command_shmem(int argc, char **argv) } for (buf = allocced_buf_chain; buf; - buf = allocced_buf_chain->next_buffer) + buf = buf->next_buffer) allocated_size += buf->buffer_size; mutex_unlock(&shmem_lock); |