Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1079045pxb; Thu, 4 Mar 2021 02:41:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxoUvdVYi3Jnx6QaK9CJ5O8u8qdrqWC+D5Wf6ns2nIxQcGDEwFSOK6L/wf8Y6IUmbmwXUV8 X-Received: by 2002:a05:6402:2058:: with SMTP id bc24mr3598186edb.243.1614854517110; Thu, 04 Mar 2021 02:41:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614854517; cv=none; d=google.com; s=arc-20160816; b=ZiL2SrpjNWlGbQtuhtecutADtd4V29LLifSNRCTliX3iu0AaQNnqUl66TPQWurlwTh ofzal1IZ5gMEAnwpzO7GmJfWcFDJe+BjD2Jn6D6plP77nQSXZ69EDS9BZpA0u7Ir3V2h FLbFMMrnDxQOogYgwgYdOoMCIpMpdReIBZMzqheUivqQXfMNnIxuD0RDWoj4w5FgcGpT b5tPhceM7vr6IxvJf2Gjh35uXoWX9QcxZIvsjaSU7D16OiFZw/NCokDSc00Hth3UJnuh brSojw/Bw6kd0xkwKM7/0e7yaofHF+Y8fnmS6720jd8RdQBYw3UmBkgAwL9nAFwHeuKL sfMA== 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=4ei//Odu2Ef7pA4nkI5E2WwYlnP69k/X6l5D38P//mA=; b=WAKaRkHgIRKOxin5AZMlHWOhgCP1IM52Xe+Dginh1MHqxsLh2Io8nedyP4te4ciWRH pvr38WXYPcccY9UvPRdnlgKZG1MyHVjEy/ZlIGfD+rS3oQcPNG1QAzIL9kRoGhe+sDxm yYDBco+vtY57tH5VuhnVUb/p+dWPZ2Z/hAW67Y0p/GmhmdwLmbxazpZcv98vaNKhVi1g PjLjUVZzmV1RDWXyKeXuA9YVRXBd81rI6hngBumUbekS10GKdo9sDpOMzEKgdiigm2EA A+3Iz3iquqlth477WFlwNsBikJ0nTKL9YPPIxJaxYZZv3rQV+FWGP+hJTdXs5+CLFE8V VLlQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bm6si7469111edb.554.2021.03.04.02.41.34; Thu, 04 Mar 2021 02:41:57 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385403AbhCCRTR (ORCPT + 99 others); Wed, 3 Mar 2021 12:19:17 -0500 Received: from smtpout1.mo529.mail-out.ovh.net ([178.32.125.2]:47383 "EHLO smtpout1.mo529.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1382826AbhCCNbo (ORCPT ); Wed, 3 Mar 2021 08:31:44 -0500 X-Greylist: delayed 535 seconds by postgrey-1.27 at vger.kernel.org; Wed, 03 Mar 2021 08:31:42 EST Received: from mxplan5.mail.ovh.net (unknown [10.108.20.7]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id B71E88C97504; Wed, 3 Mar 2021 14:21:25 +0100 (CET) Received: from kaod.org (37.59.142.95) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Wed, 3 Mar 2021 14:21:24 +0100 Authentication-Results: garm.ovh; auth=pass (GARM-95G001ede01854-56b8-48d4-abfd-1b9f7756edc3, 24CAEE7A76C7E725A9866EAA9907F8E378F99BC5) smtp.auth=clg@kaod.org X-OVh-ClientIp: 82.64.250.170 Subject: Re: arch/powerpc/sysdev/xive/common.c:279 xmon_xive_get_irq_config() warn: variable dereferenced before check 'd' (see line 261) To: Dan Carpenter , CC: , , , Michael Ellerman , Greg Kurz References: <20210227093050.GE2087@kadam> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: <05a4c050-c279-d0d6-9920-b0063bc82b0f@kaod.org> Date: Wed, 3 Mar 2021 14:21:24 +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: <20210227093050.GE2087@kadam> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [37.59.142.95] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: fe9b15cb-ed73-4835-bacb-fcbd4d77db9c X-Ovh-Tracer-Id: 10184046136024796009 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledruddtvddghedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepuffvfhfhkffffgggjggtgfhisehtkeertddtfeehnecuhfhrohhmpeevrogurhhitggpnfgvpgfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepjeduudefffelleffgfelueegueelvddvveefkedvteeivdefkeegfeehhedutedtnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghdpohiilhgrsghsrdhorhhgpddtuddrohhrghenucfkpheptddrtddrtddrtddpfeejrdehledrudegvddrleehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehgrhhouhhgsehkrghougdrohhrgh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/27/21 10:30 AM, Dan Carpenter wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > head: 8b83369ddcb3fb9cab5c1088987ce477565bb630 > commit: 97ef275077932c65b1b8ec5022abd737a9fbf3e0 powerpc/xive: Fix xmon support on the PowerNV platform > config: powerpc64-randconfig-m031-20210226 (attached as .config) > compiler: powerpc64-linux-gcc (GCC) 9.3.0 > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot > Reported-by: Dan Carpenter > > smatch warnings: > arch/powerpc/sysdev/xive/common.c:279 xmon_xive_get_irq_config() warn: variable dereferenced before check 'd' (see line 261) Yes. That's ugly :/ I would prefer to address this issue after the cleanup provided by the patchset adding an IRQ domain for IPIs. http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=228762 Most of the mess comes from the XIVE IPI HW IRQ number which hijacks IRQ number 0. It should be easier after this is fixed. Thanks, C. > vim +/d +279 arch/powerpc/sysdev/xive/common.c > > 5896163f7f91c05 C?dric Le Goater 2019-09-10 259 int xmon_xive_get_irq_config(u32 hw_irq, struct irq_data *d) > b4868ff55d082bc C?dric Le Goater 2019-08-14 260 { > 97ef275077932c6 C?dric Le Goater 2020-03-06 @261 struct irq_chip *chip = irq_data_get_irq_chip(d); > ^ > Dereferenced inside function > > 5896163f7f91c05 C?dric Le Goater 2019-09-10 262 int rc; > 5896163f7f91c05 C?dric Le Goater 2019-09-10 263 u32 target; > 5896163f7f91c05 C?dric Le Goater 2019-09-10 264 u8 prio; > 5896163f7f91c05 C?dric Le Goater 2019-09-10 265 u32 lirq; > 5896163f7f91c05 C?dric Le Goater 2019-09-10 266 > 97ef275077932c6 C?dric Le Goater 2020-03-06 267 if (!is_xive_irq(chip)) > 97ef275077932c6 C?dric Le Goater 2020-03-06 268 return -EINVAL; > 97ef275077932c6 C?dric Le Goater 2020-03-06 269 > 5896163f7f91c05 C?dric Le Goater 2019-09-10 270 rc = xive_ops->get_irq_config(hw_irq, &target, &prio, &lirq); > 5896163f7f91c05 C?dric Le Goater 2019-09-10 271 if (rc) { > 5896163f7f91c05 C?dric Le Goater 2019-09-10 272 xmon_printf("IRQ 0x%08x : no config rc=%d\n", hw_irq, rc); > 5896163f7f91c05 C?dric Le Goater 2019-09-10 273 return rc; > 5896163f7f91c05 C?dric Le Goater 2019-09-10 274 } > 5896163f7f91c05 C?dric Le Goater 2019-09-10 275 > 5896163f7f91c05 C?dric Le Goater 2019-09-10 276 xmon_printf("IRQ 0x%08x : target=0x%x prio=%02x lirq=0x%x ", > 5896163f7f91c05 C?dric Le Goater 2019-09-10 277 hw_irq, target, prio, lirq); > 5896163f7f91c05 C?dric Le Goater 2019-09-10 278 > 5896163f7f91c05 C?dric Le Goater 2019-09-10 @279 if (d) { > ^^^^^^ > Checked too late > > 5896163f7f91c05 C?dric Le Goater 2019-09-10 280 struct xive_irq_data *xd = irq_data_get_irq_handler_data(d); > 5896163f7f91c05 C?dric Le Goater 2019-09-10 281 u64 val = xive_esb_read(xd, XIVE_ESB_GET); > 5896163f7f91c05 C?dric Le Goater 2019-09-10 282 > 5896163f7f91c05 C?dric Le Goater 2019-09-10 283 xmon_printf("PQ=%c%c", > 5896163f7f91c05 C?dric Le Goater 2019-09-10 284 val & XIVE_ESB_VAL_P ? 'P' : '-', > 5896163f7f91c05 C?dric Le Goater 2019-09-10 285 val & XIVE_ESB_VAL_Q ? 'Q' : '-'); > 5896163f7f91c05 C?dric Le Goater 2019-09-10 286 } > 5896163f7f91c05 C?dric Le Goater 2019-09-10 287 > 5896163f7f91c05 C?dric Le Goater 2019-09-10 288 xmon_printf("\n"); > 5896163f7f91c05 C?dric Le Goater 2019-09-10 289 return 0; > b4868ff55d082bc C?dric Le Goater 2019-08-14 290 } > > --- > 0-DAY CI Kernel Test Service, Intel Corporation > https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org >