Skip to content

Commit 962fe7a

Browse files
sjp38torvalds
authored andcommitted
mm/damon/vaddr: hide kernel pointer from damon_va_three_regions() failure log
The failure log message for 'damon_va_three_regions()' prints the target id, which is a 'struct pid' pointer in the case. To avoid exposing the kernel pointer via the log, this makes the log to use the index of the target in the context's targets list instead. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: SeongJae Park <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 251403f commit 962fe7a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

mm/damon/vaddr.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,19 @@ static int damon_va_three_regions(struct damon_target *t,
232232
static void __damon_va_init_regions(struct damon_ctx *ctx,
233233
struct damon_target *t)
234234
{
235+
struct damon_target *ti;
235236
struct damon_region *r;
236237
struct damon_addr_range regions[3];
237238
unsigned long sz = 0, nr_pieces;
238-
int i;
239+
int i, tidx = 0;
239240

240241
if (damon_va_three_regions(t, regions)) {
241-
pr_debug("Failed to get three regions of target %lu\n", t->id);
242+
damon_for_each_target(ti, ctx) {
243+
if (ti == t)
244+
break;
245+
tidx++;
246+
}
247+
pr_debug("Failed to get three regions of %dth target\n", tidx);
242248
return;
243249
}
244250

0 commit comments

Comments
 (0)