Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp212572pxu; Tue, 5 Jan 2021 08:55:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwJow5iuE1v4XzQnkuT9krqtgwmjpPEkdtuofmSRAKytOpSsmcOLZYpKTdmhmBYiN+tMLvm X-Received: by 2002:a05:6402:171a:: with SMTP id y26mr647563edu.371.1609865714456; Tue, 05 Jan 2021 08:55:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609865714; cv=none; d=google.com; s=arc-20160816; b=Oq9mUiGDwJuhdasros0S2GUK8iax5c3CXDJDQTa+ubm5M1PqrJUTWiBZLZJOUTX+cR 2fvI0eaBvwDbx2lFINt4tDGv0L+Mlm2jx8pfet2K+djNm7GYt2NaYsSEGytRD4kLZkkI HFsYf2UqiSISqOEgP/sijAncijKeE2NS/2CclwAkme0asfSLUcchXjBzuTctavV9Fbb/ PmfFAsvg4L2C5RGOGUFBj4vdfH4yotX23chHGCGWKB6D37gj9HpJpeVGbJm3ogDBiv0r UE4nSuylnGuPfoLcz5mQGRRWUmPTm3m8/h8d7aEassdCQBsa4yC/CNsSpM+CrntcPQPZ xmFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject:dkim-signature; bh=OB4QxC/gO4zMAIb2hjh/npymPegud6p74FvO1Z0m3Is=; b=yvIU9B6/gFGkKfN8I0oH4NTyP+8HzZjecYSuIZj8XjfOeHv7T3VnMMJ11M83K7mfzp bmQr98h38O+PxSOK/g5DT37CjH+B6gtntsF9oxNrQ/fby6TNXidSWVHJ47OCFOUxiVCm bdIjgs+teNipib8YWcM9bX6RrZI8HQ5cCX0/NqmquyP30g7IBFK6XaRSx2gvlvoPkD6H /U/jMrFibzpE78WzqNnDAe6lks0+J5Cg49TDcWHBiEWmEuvhxDqMahBs9b/s1UFdgtVG RwkvHJrDpI/cAXSyRFi1DWcn9EOdd6jfMEaZS6RqboQz56Hqh2OvyoEUGRlHp9m3R3HG D7wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=T+QUNk7p; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h15si5915ejq.383.2021.01.05.08.54.50; Tue, 05 Jan 2021 08:55:14 -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; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=T+QUNk7p; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729909AbhAEQwN (ORCPT + 99 others); Tue, 5 Jan 2021 11:52:13 -0500 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:2345 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729683AbhAEQwM (ORCPT ); Tue, 5 Jan 2021 11:52:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1609865532; x=1641401532; h=subject:from:to:cc:references:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=OB4QxC/gO4zMAIb2hjh/npymPegud6p74FvO1Z0m3Is=; b=T+QUNk7pV4ry7GhFUbFp10sK+dztazPDDJfjJJjgRBgTwtffEouu5PPU CliQCKcvjIgvzHwTje7dyfQ3/sH9HgwV4rsLshfjiRLiSkAP5ghpgxjF6 19C61QF18KvAciqjvHiT9miOgjNMKZJRA37LYNvV/a0Bb2M9NJWp3ZeP9 0=; X-IronPort-AV: E=Sophos;i="5.78,477,1599523200"; d="scan'208";a="108404997" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-1e-c7f73527.us-east-1.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 05 Jan 2021 16:51:31 +0000 Received: from EX13MTAUWC002.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-1e-c7f73527.us-east-1.amazon.com (Postfix) with ESMTPS id C53D1ACF1A; Tue, 5 Jan 2021 16:51:30 +0000 (UTC) Received: from EX13D12UWC002.ant.amazon.com (10.43.162.253) by EX13MTAUWC002.ant.amazon.com (10.43.162.240) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 5 Jan 2021 16:51:30 +0000 Received: from [10.95.184.140] (10.43.161.179) by EX13D12UWC002.ant.amazon.com (10.43.162.253) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 5 Jan 2021 16:51:29 +0000 Subject: Re: [PATCH v2] scripts/gdb: fix list_for_each From: George Prekas To: Jan Kiszka , Kieran Bingham CC: References: <4ae23bb1-c333-f669-da2d-fa35c4f49018@amazon.com> Message-ID: <04baeb3e-4b46-ae3a-b4e1-4663d1510b05@amazon.com> Date: Tue, 5 Jan 2021 10:51:27 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <4ae23bb1-c333-f669-da2d-fa35c4f49018@amazon.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.43.161.179] X-ClientProxiedBy: EX13D19UWA001.ant.amazon.com (10.43.160.169) To EX13D12UWC002.ant.amazon.com (10.43.162.253) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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! Any updates on this? Thanks, George