/* Scan the objects already referenced (gray objects). More objects will be referenced and, if there are no memory leaks, all the objects are scanned.  */
static void scan_gray_list(void)
/* Scan the objects already referenced (gray objects). More objects will be referenced and, if there are no memory leaks, all the objects are scanned.  */
static void scan_gray_list(void)
{
	struct kmemleak_object *object, *tmp;
	object = list_entry(gray_list.next, typeof(*object), gray_list);
	while (&object->gray_list != &gray_list) {
		cond_resched();
		if (!scan_should_stop())
			scan_object(object);
		tmp = list_entry(object->gray_list.next, typeof(*object),
				 gray_list);
		list_del(&object->gray_list);
		put_object(object);
		object = tmp;
	}
	WARN_ON(!list_empty(&gray_list));
}