Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43ed5d6e authored by Catalin Marinas's avatar Catalin Marinas
Browse files

kmemleak: Scan all thread stacks



This patch changes the for_each_process() loop with the
do_each_thread()/while_each_thread() pair.

Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent 8e019366
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -1074,7 +1074,6 @@ static void kmemleak_scan(void)
{
{
	unsigned long flags;
	unsigned long flags;
	struct kmemleak_object *object, *tmp;
	struct kmemleak_object *object, *tmp;
	struct task_struct *task;
	int i;
	int i;
	int new_leaks = 0;
	int new_leaks = 0;
	int gray_list_pass = 0;
	int gray_list_pass = 0;
@@ -1141,15 +1140,16 @@ static void kmemleak_scan(void)
	}
	}


	/*
	/*
	 * Scanning the task stacks may introduce false negatives and it is
	 * Scanning the task stacks (may introduce false negatives).
	 * not enabled by default.
	 */
	 */
	if (kmemleak_stack_scan) {
	if (kmemleak_stack_scan) {
		struct task_struct *p, *g;

		read_lock(&tasklist_lock);
		read_lock(&tasklist_lock);
		for_each_process(task)
		do_each_thread(g, p) {
			scan_block(task_stack_page(task),
			scan_block(task_stack_page(p), task_stack_page(p) +
				   task_stack_page(task) + THREAD_SIZE,
				   THREAD_SIZE, NULL, 0);
				   NULL, 0);
		} while_each_thread(g, p);
		read_unlock(&tasklist_lock);
		read_unlock(&tasklist_lock);
	}
	}