Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp360048pxk; Thu, 24 Sep 2020 07:22:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhe2VLdhYJ37/vmA6NGbb87Pn6rawVJQv+CY6yuCZn/Wnkda1GXV6a36EaLynrVAE7bYEo X-Received: by 2002:a05:6402:1d05:: with SMTP id dg5mr125897edb.67.1600957361523; Thu, 24 Sep 2020 07:22:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600957361; cv=none; d=google.com; s=arc-20160816; b=NLomzHbnDQFTJ3bLpgS3zzDTAgVk6LkZEmdhFMcHm2HaFVDxMHr3XTNvWQBXAedbT+ +tUseQ69uwYqOGq7GGXJEP8w8IKXeMaHDcN4QT9/LqlRMTYYV9bc5UPBtkHfRDrop6yG 3TNofmwfmX2pX0SNQadNT2CucsPM7jE/nvW/OKY562B4vmITXvtvCE0cLH67obBJ1thV Hjvk/ohPr3LneQhKZLFsIPjy4Dq/TMGSGksSHncoRObovh9dMAmJxtMLAHrNBdi2G3bg pdTySaYcGgst51+ot9lpoVj4EVYA0bulfEowVLMGiC4eqgr7bjth0eNNgDzkY5NUmuFO uHzw== 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 :mime-version:user-agent:date:message-id:subject:from:cc:to :dkim-signature; bh=AXfCp1SiddQmAtKsdozKcAnnSiVqTWsFP9hnxw69msY=; b=luQEGmiZrq1AaoXimUGCgNc1fJLmj8AjuWwJ82EXcjCO9WI0n8MYdkmpQxYc1drFT/ MQcd1YXKECmFVwLaLNNYDhDcUV56NpkvMUCXXvn8POkzM1UkpH/mFojLr4ew0TGquFPc zQky/sfpn46xWEZ2ir8j60lV0+ofvVPLIjbrpb7qlLPBaBvpqzDemTYJa+IBy8BTHzS7 vkx8QJeDHJcnE3bzH2TRn2mAqqtS9ZKBlFVnOFSyinmfMDKIe3NTy9lbO62scXi5hj0V 1qoLwIZ1B3hAV0LR9/9FW9RhW1YIHrOhCrH1E4hTTGZFyHSTxtm8GfmdiL9G3QBDDemo 4ZWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=cUBotEzS; 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 rv15si2212353ejb.364.2020.09.24.07.22.17; Thu, 24 Sep 2020 07:22:41 -0700 (PDT) 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=cUBotEzS; 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 S1728171AbgIXOVD (ORCPT + 99 others); Thu, 24 Sep 2020 10:21:03 -0400 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:60403 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727974AbgIXOVC (ORCPT ); Thu, 24 Sep 2020 10:21:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1600957262; x=1632493262; h=to:cc:from:subject:message-id:date:mime-version: content-transfer-encoding; bh=AXfCp1SiddQmAtKsdozKcAnnSiVqTWsFP9hnxw69msY=; b=cUBotEzSki0Jc+pjtFKv78oMhAVaizhY732drj82syQAQ0TJPVYMSzKU Maj8lbLxRhqjDLzAecX6hOuEgtb2a5Pw84g78d5xnv5ee5dlP5pSRlav6 myDnOj57T3Lzdgyy3N6FWgLceCQAzWKmhjdLnL8J3lOHnug59z9ic9hRF U=; X-IronPort-AV: E=Sophos;i="5.77,298,1596499200"; d="scan'208";a="55840363" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2b-81e76b79.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP; 24 Sep 2020 14:21:01 +0000 Received: from EX13MTAUWC002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan3.pdx.amazon.com [10.170.41.166]) by email-inbound-relay-2b-81e76b79.us-west-2.amazon.com (Postfix) with ESMTPS id B2731A081C; Thu, 24 Sep 2020 14:20:59 +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; Thu, 24 Sep 2020 14:20:59 +0000 Received: from [192.168.7.67] (10.43.162.133) by EX13D12UWC002.ant.amazon.com (10.43.162.253) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 24 Sep 2020 14:20:58 +0000 To: Jan Kiszka , Kieran Bingham CC: From: George Prekas Subject: [PATCH v2] scripts/gdb: fix list_for_each Message-ID: <4ae23bb1-c333-f669-da2d-fa35c4f49018@amazon.com> Date: Thu, 24 Sep 2020 09:20:56 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Originating-IP: [10.43.162.133] X-ClientProxiedBy: EX13D47UWA001.ant.amazon.com (10.43.163.6) To EX13D12UWC002.ant.amazon.com (10.43.162.253) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.16.6