Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp275246lqa; Sat, 27 Apr 2024 01:45:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXkKNVAA6ltKGSB1/VsPb8jvRhlPS7OHOZyQtwsvtwn9E8Lj8E1fJgJX5VnqxGsYQLgXwW49ellGHV/Ie+0J7aRz9ZB8KDMMmgLD7AEoA== X-Google-Smtp-Source: AGHT+IGOZ2Q5sfZcdyIeo9eBdZnwvFAI+2IIwOLm/uDfhVF9lwV5ARQkhPl42/uQrFlvwNp9+bcP X-Received: by 2002:a17:906:2718:b0:a52:65bd:a19a with SMTP id z24-20020a170906271800b00a5265bda19amr3323464ejc.57.1714207530142; Sat, 27 Apr 2024 01:45:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714207530; cv=pass; d=google.com; s=arc-20160816; b=qnqOuA88ybwnD/QFOJFyClQ+gSImyK053NvH+ns9OXhaYA0C1A9Ga4KNPzEklfBGkj V1yewvGPHQxBVm2QlwnQ1r8wHoLeraDTSOwe82Xt9E8srwQ+O1HGhpQu6U+C08sQFJZQ N1N50IFINORNwGIE7hUkiH2YIP0et19cyT3/KUCDvvAJs9lmyhuZMxIZBqm0SPnFyOuc Sf3WeIPhavppVAzkG1XAnZ9+Ax/P73+QWjNwhi0qHKM16b3UoaNsRQIIzID1F8BqQYot KNhqMshEsRA4ZcA54zHAw7gLawAmKG5R+89dYCYYaB+lxuf6WhPnuFZYY3kn0rh3eawq MuZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=uhMTax7vcBSN8/vVcReWjI4f74u0LbSaDXTLifTLE9U=; fh=LtLCbKvBhtn3oiA67JkDwWo5mwASB2XA39Wm5n9UxHI=; b=tuQAPRjPEkKKxR6T7bdr2lm9N4aa00+cG6F3VI0e19n47leKkXCX9BNvU+jYoYVkZ5 hJPcypQLMJ9iTr5avwg+8dPICe7sn3niAFqBbvx9Zp+Xj9bRiCD5UuArV5vCBpdUd3iv 5+gwfYQT7uj4HPolamM8fDBhe8yEE/HjPDn3GM5uHO04QKr85bzgMBjOSO9PQZeWGFCR S80k6Njs4mIsGbfP0PmfXIkHth39qANZefEO/Gp0ZMoczX1dOD4IQNDSxTQN62iJCEbD b18LjHAuib9Laz3Qd03e2321QTLaSNe9TxTs8PS/3dFhNBJE1Qd/FJSNKtuqELijoXvy 7HUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N4BTyCLN; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-160962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160962-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s9-20020a170906a18900b00a55ac7c4b65si8031591ejy.287.2024.04.27.01.45.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 01:45:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N4BTyCLN; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-160962-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160962-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D9D061F22511 for ; Sat, 27 Apr 2024 08:45:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 948161EB2F; Sat, 27 Apr 2024 08:45:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="N4BTyCLN" Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 720108BFC for ; Sat, 27 Apr 2024 08:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714207510; cv=none; b=ZYJkMpxZ5/mRpPhy8ZfaOBv7mN2ag2t/CuiwfqrmvCBa5XoWD12HUSkWqBpYgFKKBojDvBvshJ8ekv4MKPeMqB3QaYnVeLSsmlmFizx//ClpTkavSwJrcSCgwz6LeJabfQERz8loKfrzt+LE523xFvHCOFe2bEA1QIXU6aYBGWU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714207510; c=relaxed/simple; bh=yF+2ANE6qdkqttXSkb1nmNAoTIlP+U26rnn+JAKSYQk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uG09y3ahgGQjbxqtyCiXnR9p4tvYZn4kthNCWU+2kPN8DxxDxt7envldhCUT5As1qx0sbCJBirte2ZhG+Nfl9BktVjh5fvNBPD9SzeZMSgSAoXJDOTX3YnGnfL32rTk1w5MfBsWLenV7LdfMjCbY9iOx1jdoYkD/J1rQH+WXZG8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=N4BTyCLN; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1e65b29f703so26680545ad.3 for ; Sat, 27 Apr 2024 01:45:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1714207509; x=1714812309; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=uhMTax7vcBSN8/vVcReWjI4f74u0LbSaDXTLifTLE9U=; b=N4BTyCLNRyUP0GwgsfSPd7Ths/LKq51nFh/JfPpl29GBOs5t3C6127gR35zk817wg2 abLmtFegUmvIT1Ub04NgM4WkHlW4SxM1NEU+vklHwCI7h77whXPLh5PCrk8xsUb56Pzt CvZd5A86uSPCVlX0r0Hr1FFSNoDdNx57k8qUqQKk0pus2UU/y+SH7hZSpP8oqFhyvB3g /sD8/sgfrN+M/zwbDAv0yOANjMAs5913oCihqOyHx538EOVZkzz0/oFJzA+Q6dC09b6b VymKi7wwEO1RHBIvrO4mj4YdbTEA44hn8nQyylk1IUmfDnMUnQ1ZTCYjm2bO7pDw8G12 3BwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714207509; x=1714812309; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=uhMTax7vcBSN8/vVcReWjI4f74u0LbSaDXTLifTLE9U=; b=ck5bypANQpePTJXReSyqda39P9xc8ubT6ld1kiMGBBFj0/YsOXjfCg74r9aObijAoQ 96c0y4065wsTb/q6Fmend/COerVmaGpDSAl2tjim4WPfhDo9/THsJ6xbA4SHekB9gJwG Y8S1nYywcmSnNtblVnw/0d7A1Sfht2c9ug7bFXLpPLgd7dRE8forH1MaKfRpwPZ33C7/ 2HSjDqKH9VZPbLQHREkg0noAsgW6b6hWlgZKGUXkjeN0OpcnBcVre1WjrPF1YyPQcSNe 8ZAdmxEXfTUgim6WooqGw5fte+XPaP9ecg6xJy3q1vbeEDBALPUHtoMC0HSTzfd7ma4L fJGA== X-Forwarded-Encrypted: i=1; AJvYcCUyqf/qyo34SCQ/m4K0pDbD61AnaNZP5+Q0h3Z6EviQOnapC5eaDbEYnEVZYY76LPHAULCth1jezC3Vw9PG9Jdd+lFAc2EhWseEV2Bd X-Gm-Message-State: AOJu0YyfVKUW2dz0xKbsoZUYZoo0DoEjJxtf9NYfjdKeF6St6Q3ZDAkY i1elsTIt2f+yWbDmsQ+0CnLmgpyy97npr/B4scfHlq686Dug0p/TR9yoUqV9ug== X-Received: by 2002:a17:902:ed05:b0:1e2:bf94:487 with SMTP id b5-20020a170902ed0500b001e2bf940487mr4849343pld.57.1714207508549; Sat, 27 Apr 2024 01:45:08 -0700 (PDT) Received: from thinkpad ([120.60.53.237]) by smtp.gmail.com with ESMTPSA id x1-20020a170902ec8100b001e5cadbdf8csm16723785plg.37.2024.04.27.01.45.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 01:45:07 -0700 (PDT) Date: Sat, 27 Apr 2024 14:14:59 +0530 From: Manivannan Sadhasivam To: Alexander Lobakin Cc: Aleksandr Mishin , Rob Herring , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , Serge Semin , Niklas Cassel , Yoshihiro Shimoda , Damien Le Moal , Siddharth Vadapalli , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org Subject: Re: [PATCH v2] PCI: dwc: keystone: Fix potential NULL dereference Message-ID: <20240427084459.GD1981@thinkpad> References: <20240425092135.13348-1-amishin@t-argos.ru> <63b89455-3e30-421a-a082-00d39e836e20@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <63b89455-3e30-421a-a082-00d39e836e20@intel.com> On Thu, Apr 25, 2024 at 03:00:14PM +0200, Alexander Lobakin wrote: > From: Aleksandr Mishin > Date: Thu, 25 Apr 2024 12:21:35 +0300 > > > In ks_pcie_setup_rc_app_regs() resource_list_first_type() may return > > NULL which is later dereferenced. Fix this bug by adding NULL check. > > > > Found by Linux Verification Center (linuxtesting.org) with SVACE. > > Please stop spamming with "potential fixes" made mechanically from > static analyzer reports without looking into the code flow. These > patches are mostly incorrect and may hurt. > Either have a stable repro and then fix the real bug or don't touch > anything at all. > This patch obviously fixes the potential issue where resource_list_first_type() may return NULL if the MEM range is not provided in DT. pci_parse_request_of_pci_ranges() will just emit a warning in that case and this code path will cause a NULL pointer dereference. Even though this situation means that the DT is broken, it still makes sense to have the checks in place. - Mani -- மணிவண்ணன் சதாசிவம்