Skip to content

Commit b1f44cd

Browse files
sjp38akpm00
authored andcommitted
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()'. Link: https://lkml.kernel.org/r/[email protected] Fixes: f23b8ee ("mm/damon/core: implement region-based sampling") Signed-off-by: SeongJae Park <[email protected]> Reported-by: Hyeonggon Yoo <[email protected]> Tested-by: Hyeonggon Yoo <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent fac35ba commit b1f44cd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

mm/damon/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ struct damon_target *damon_new_target(void)
313313
t->pid = NULL;
314314
t->nr_regions = 0;
315315
INIT_LIST_HEAD(&t->regions_list);
316+
INIT_LIST_HEAD(&t->list);
316317

317318
return t;
318319
}

0 commit comments

Comments
 (0)