Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp298044pxu; Tue, 5 Jan 2021 11:11:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJziZo1fr5KPf3KOr+KE0A9I6aX11Ue2QyiTGi8JkO/y2m4bgbFW/Zmx2d8m+00VrwYStN0T X-Received: by 2002:aa7:c1c6:: with SMTP id d6mr1240415edp.275.1609873865735; Tue, 05 Jan 2021 11:11:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609873865; cv=none; d=google.com; s=arc-20160816; b=kL87hs6L4OXCkwceaPMiF82Ur5eBJAIV/2JI9EQhaqdZG6P+8lmhrqBYZT+Zwo9pG9 0cFjzCNc+w2AJVWNNWwCOIvrMnQRgIW6ycjOnwUlXW7GW09wKaB1sbIQy8Mpv6SkBfNW xTGZwtqN5XY//ohxJ2AxmfDJCAiVb8PXp7MCUvfezs46ML16x5aopS1QoZ/a4U7cGfv+ 7AT0opCgh9vrIRqrfMmIcU7GC2ijce+mZWYhgSOX5sf+0zteGdJnHb1ckl17fwG0h1sG pQkqvekD9w1HssFjoFuFaUxkY3f8Gpxu6piW4olf3pAMzdqUEvO2Aov/ywhs6BUGzC7l dqRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=SkmERoSbkg5aFnpCxgmYVnMd1pti4wnzj25ufiabiXU=; b=tLRXX5s4SCpCfZT46psoJYwD+hLKgNQR2s62K0YU005wJ9sk1f1zo9t5zFU1iCg24E FUDeHzaaIRQq5nYQc+2HVDDh57A1G2Ytj8NECsQQ7Xe0axtG3f/pnvQis6gu/lZ9p0Ts VfbAMvLKQwmQn5zbNLHT/TmsyDZcAh97402jMrQGKVNMxZLs5Txla6I2EFbZqEDfA6+2 3yAaoca/gUpZCE1ADla8LMioXdcqESavi4nt174HpdPfHYqWZ4zka0hu3c136bEI4i6s H4l2NYcaxnldNTISYqDxBfE1FG+NGbQRdQBL0XfLvG5HIzjlM4V7BkBRMEFUD111hejd 4hOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g5si322876edj.194.2021.01.05.11.10.42; Tue, 05 Jan 2021 11:11:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730735AbhAETJO (ORCPT + 99 others); Tue, 5 Jan 2021 14:09:14 -0500 Received: from gecko.sbs.de ([194.138.37.40]:42433 "EHLO gecko.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730703AbhAETJO (ORCPT ); Tue, 5 Jan 2021 14:09:14 -0500 Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by gecko.sbs.de (8.15.2/8.15.2) with ESMTPS id 105J8N2F006362 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Jan 2021 20:08:23 +0100 Received: from [167.87.32.120] ([167.87.32.120]) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id 105J8MIv030651; Tue, 5 Jan 2021 20:08:22 +0100 Subject: Re: [PATCH v2] scripts/gdb: fix list_for_each To: George Prekas , Kieran Bingham , Andrew Morton Cc: linux-kernel@vger.kernel.org References: <4ae23bb1-c333-f669-da2d-fa35c4f49018@amazon.com> <04baeb3e-4b46-ae3a-b4e1-4663d1510b05@amazon.com> From: Jan Kiszka Message-ID: Date: Tue, 5 Jan 2021 20:08:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <04baeb3e-4b46-ae3a-b4e1-4663d1510b05@amazon.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05.01.21 17:51, George Prekas wrote: > 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 >> --- >>  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! Same to you! > > Any updates on this? > Sorry, slipped through. Reviewed-by: Jan Kiszka Andrew, please pick this up. Jan -- Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux