From acfd11ae99ee916a7fc5d95c14014b17f08a1c2e Mon Sep 17 00:00:00 2001 From: Youngjae Cho Date: Tue, 11 Feb 2020 17:53:57 +0900 Subject: [PATCH] Fix coverity issue CID 1099199 (#1 of 1): Read from pointer after free (USE_AFTER_FREE) 20. deref_after_free: Dereferencing freed pointer elem. Change-Id: I85c34f351db0cc10ce384176b90ba72067e3c051 Signed-off-by: Youngjae Cho --- src/cpu/pmqos.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpu/pmqos.c b/src/cpu/pmqos.c index ff483d8..c2bbcda 100644 --- a/src/cpu/pmqos.c +++ b/src/cpu/pmqos.c @@ -77,7 +77,7 @@ int set_cpu_pmqos(const char *name, int val) static void pmqos_unlock_timeout_update(void) { - dd_list *elem; + dd_list *elem, *elem_next; struct pmqos_cpu *cpu; int delta = 0; @@ -98,7 +98,7 @@ static void pmqos_unlock_timeout_update(void) /* Delete previous request */ } - DD_LIST_FOREACH(pmqos_head, elem, cpu) { + DD_LIST_FOREACH_SAFE(pmqos_head, elem, elem_next, cpu) { if (cpu->timeout > 0) continue; DD_LIST_REMOVE(pmqos_head, cpu); -- 2.7.4