summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2018-03-01 15:08:05 +0100
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-03-19 22:04:02 +0000
commit005aa7dfbcd9bdcd4fd5eaa7a5c95c228a765364 (patch)
treed80faa0f618f0fd31b16248d1fab7b9fe1a6722d
parent671d1c309edcea15859f03537123325c66169e99 (diff)
downloadchrome-ec-005aa7dfbcd9bdcd4fd5eaa7a5c95c228a765364.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> (cherry picked from commit f917f447d7206faa98ea2c1b1915fb4196913ef0) Reviewed-on: https://chromium-review.googlesource.com/969629 Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> Tested-by: Vadim Bendebury <vbendeb@chromium.org>
-rw-r--r--common/shmalloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/shmalloc.c b/common/shmalloc.c
index 6d3d4c728f..5f88f7318f 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);