All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts/gdb: fix list_for_each
@ 2020-09-22 14:28 George Prekas
  2020-09-22 14:32 ` Jan Kiszka
  0 siblings, 1 reply; 6+ messages in thread
From: George Prekas @ 2020-09-22 14:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jan Kiszka, Kieran Bingham

If the next pointer is NULL, list_for_each gets stuck in an infinite
loop.

Signed-off-by: George Prekas <prekageo@amazon.com>
---
  scripts/gdb/linux/lists.py | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/scripts/gdb/linux/lists.py b/scripts/gdb/linux/lists.py
index c487ddf09d38..424a91c1aa8b 100644
--- a/scripts/gdb/linux/lists.py
+++ b/scripts/gdb/linux/lists.py
@@ -27,6 +27,8 @@ def list_for_each(head):
          raise TypeError("Must be struct list_head not {}"
                             .format(head.type))

+    if head['next'] == 0:
+        return
      node = head['next'].dereference()
      while node.address != head.address:
          yield node.address
-- 
2.24.3.AMZN



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-23 21:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 14:28 [PATCH] scripts/gdb: fix list_for_each George Prekas
2020-09-22 14:32 ` Jan Kiszka
2020-09-22 17:17   ` Prekas, George
2020-09-22 19:11     ` Kieran Bingham
2020-09-23 13:13       ` George Prekas
2020-09-23 21:17         ` Kieran Bingham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.