[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ae23bb1-c333-f669-da2d-fa35c4f49018@amazon.com>
Date: Thu, 24 Sep 2020 09:20:56 -0500
From: George Prekas <prekageo@...zon.com>
To: Jan Kiszka <jan.kiszka@...mens.com>,
Kieran Bingham <kbingham@...nel.org>
CC: <linux-kernel@...r.kernel.org>
Subject: [PATCH v2] scripts/gdb: fix list_for_each
If the list is uninitialized (next pointer is NULL), list_for_each gets
stuck in an infinite loop. Print a message and treat list as empty.
Signed-off-by: George Prekas <prekageo@...zon.com>
---
scripts/gdb/linux/lists.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/scripts/gdb/linux/lists.py b/scripts/gdb/linux/lists.py
index c487ddf09d38..bae4d70b7eae 100644
--- a/scripts/gdb/linux/lists.py
+++ b/scripts/gdb/linux/lists.py
@@ -27,6 +27,11 @@ def list_for_each(head):
raise TypeError("Must be struct list_head not {}"
.format(head.type))
+ if head['next'] == 0:
+ gdb.write("list_for_each: Uninitialized list '{}' treated as
empty\n"
+ .format(head.address))
+ return
+
node = head['next'].dereference()
while node.address != head.address:
yield node.address
--
2.16.6
Powered by blists - more mailing lists