mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
UPSTREAM: mm/damon/core: initialize damon_target->list in damon_new_target()
'struct damon_target' creation function, 'damon_new_target()' is not initializing its '->list' field, unlike other DAMON structs creator functions such as 'damon_new_region()'. Normal users of 'damon_new_target()' initializes the field by adding the target to DAMON context's targets list, but some code could access the uninitialized field. This commit avoids the case by initializing the field in 'damon_new_target()'. Bug: 254441685 Link: https://lkml.kernel.org/r/20221002193130.8227-1-sj@kernel.org Fixes:f23b8eee18("mm/damon/core: implement region-based sampling") Signed-off-by: SeongJae Park <sj@kernel.org> Reported-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> (cherry picked from commitb1f44cdaba) Signed-off-by: Lee Jones <joneslee@google.com> Change-Id: I42adfe86cbe78f45c04a66d486261234e16d463f
This commit is contained in:
committed by
Treehugger Robot
parent
94ce24b0ce
commit
08bf420407
@@ -155,6 +155,7 @@ struct damon_target *damon_new_target(unsigned long id)
|
||||
t->id = id;
|
||||
t->nr_regions = 0;
|
||||
INIT_LIST_HEAD(&t->regions_list);
|
||||
INIT_LIST_HEAD(&t->list);
|
||||
|
||||
return t;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user