mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: George Prekas <prekageo@amazon.com>
To: Jan Kiszka <jan.kiszka@siemens.com>,
	Kieran Bingham <kbingham@kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] scripts/gdb: fix list_for_each
Date: Tue, 5 Jan 2021 10:51:27 -0600	[thread overview]
Message-ID: <04baeb3e-4b46-ae3a-b4e1-4663d1510b05@amazon.com> (raw)
In-Reply-To: <4ae23bb1-c333-f669-da2d-fa35c4f49018@amazon.com>

On 9/24/2020 9:20 AM, George Prekas wrote:
> 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@amazon.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

Happy New Year!

Any updates on this?

Thanks,
George


  reply	other threads:[~2021-01-05 16:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-24 14:20 George Prekas
2021-01-05 16:51 ` George Prekas [this message]
2021-01-05 19:08   ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04baeb3e-4b46-ae3a-b4e1-4663d1510b05@amazon.com \
    --to=prekageo@amazon.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kbingham@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®