Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp863235lqo; Fri, 17 May 2024 04:06:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUd6brW1whhRxgqu4oOr1kSVSlmVO4gc4OLXlF6eU8+hmeSj5Bg6tUiNoK+RLhxFT+jBJySBsJIZg2i/Nkpbvlr38A8Q63+v3R9GjBofg== X-Google-Smtp-Source: AGHT+IH32hz+W7usxuma/Pgsm5BFE5+D5Uztf7zmmYy9PwHfUSPQvoQrMpzkVL9+0anfZ/nH3W6Z X-Received: by 2002:ac8:5d12:0:b0:43b:1472:1671 with SMTP id d75a77b69052e-43dfdaaa70fmr294306281cf.17.1715944011021; Fri, 17 May 2024 04:06:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715944011; cv=pass; d=google.com; s=arc-20160816; b=r/qMqr6l9/XxpirEUVHtNWGmfo4c8771hcSdnRyBEe7r8B7u7PoCoSPnMlt05SXBh2 eyU9qWRzi0EWjkeSze9+Up4DqZlN8s7XHjX2hHwJWkhQRCdjef5MLd9Yt3sTw+ErrFm2 gLwxjcMvZNdQgnTOl1u3feTNIoQTMJsbOxZf9L5TVcdU0/qmyO4LXCxS+fqOHNPV8xAt MKwXqzh31yDwu0GlzkgxBu0fc5LHdpDjykoicEJ9wcJIPEYJoKu5+OJZz7c6YHixcd2k 5H37den8NvDhAMwK0vFHle0aEBjRaK5MgiC6ip1pQWdXHkV+70NTC5EFC9tAhN4QMzig wY6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=p83S38X1HgQAB74fAqntKRjS6xpoQ6Z5CQG1AzBL1YY=; fh=65vXDhLmrx/33H80fkdKog088kB546KA5QrebdM887k=; b=aAFnBSEo5F04RVTNzFtKOedHpynlhBBhQs2XZ4VLuGKe0bvuRdfxwyK0eOoawx5C9S SKO0iywKuOWGAFUVCzd0D3XXXjmx63o5xBJuNobLClMXkztBVoEUcx2FSwFWej1MR86g XGcJLAQTakUH3RK7WkuXR4IhmvCtturAaVp1DDTODG7r5X4InDr7SfY7R7+t4jLTDOn+ t13yDqhWnGerJ61UQDNrsIdHuFqhmhXhmoYsm4INi8YrGBIPeYGWpJWp/XNivMGSgEPf dQeYSnqpTgOpk+bHh+ZSKRzyOFBQeWY6+AnAsPnNRofpLDse/ADCgFmecnQphpqK9wGN 8aug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-182022-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182022-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-43df56d56d5si186516761cf.676.2024.05.17.04.06.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 04:06:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182022-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-182022-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182022-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linux.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id BD40B1C20CEB for ; Fri, 17 May 2024 11:06:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAFE33BBE5; Fri, 17 May 2024 11:06:43 +0000 (UTC) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 2489D3BB20; Fri, 17 May 2024 11:06:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715944003; cv=none; b=TaKy0S6jQntza95fYCaGHK6RZRxAQYoOS2zfWUc4qDNBb5Rcay/cbTkGRJU5lLNdjd7Mxkoev3uS1nTUCQmizE6DDJbj0dxmpgEVkCgghW0BBESptsFfuDxSf96N/g6PBmxNTR8DVsc/RxfUuhpHTSuC3J/F2yi98OLxDpFLCeI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715944003; c=relaxed/simple; bh=6YKYu+nwgoHIhxuCcyfKEm/0MyLgoLFDAQc26AajwQA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=O2V3I376Sf/h9gGx2OJebqpgbrT83nzqpIPVlGIvLpyH1zmQFkivkqCDbLguLqMGiZPGo5aEfER9d9cpNSFFvSpr0Y+EmJ3uRTX9aYylGZOf9rkpJqzG/d34yUCNe1iXq+nOm0abi01hnl7qwqMtDujxAhktf4e0bVkl/iSPG5s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.com; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1ec92e355bfso5152785ad.3; Fri, 17 May 2024 04:06:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715944001; x=1716548801; h=in-reply-to: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=p83S38X1HgQAB74fAqntKRjS6xpoQ6Z5CQG1AzBL1YY=; b=i6T93F2DR7pGHiicUazUWdhTLVoCwexdqKHzhGr1PR3+ZOLWrL+loyAVXR3xbmnf5P AyCpF8bJezXhO3tI9f6QWvMGaPUfggrSNLlKabjYEeOY/ZcMPBz9Wjk6CYHu33x49iim RjP2QN3uNckOqkfI9kMrxgmK+uTeMVMMg3PFdwqJ0e3IXItwjIWcrTEJjPau4Tgstsir yYWShxqjmG3+/OAgpqqCzQFWpBTv4jmQNJoal9U1HjGztGzCWaeL4W1ITzsiFif8qK+j IwrvlamI3f8uFa+3qTe1W5aTZgI2nzyMjZ96oUmC3RJ7bHzkuciFCX1jyqAsHdvrAsCm j84g== X-Forwarded-Encrypted: i=1; AJvYcCWbNaNRH06MEt0N6J1T6DGtjrOFFyY0mK4nRlQGvpx3I3QVAQiA51b4fWHZsZo4KCQVeY9pr9OJS33JPoiN6O09EuNsAgLsgxzI7G9GEeVr5t3Nl5CdMyRvVpliBZXFFDWoqBN6Cqji X-Gm-Message-State: AOJu0Yx/C1KXD9UKFxSXU0K3wHlqNJV3t12DMt7a2prREZV/Opl+2zCt 92mk9kpWt9M5vtt3inhBIlXixFLE6wEGYteQMv4ZFFYyY4Dn/9io X-Received: by 2002:a17:903:2d1:b0:1f2:e14b:3d91 with SMTP id d9443c01a7336-1f2e14b3fc6mr19558985ad.59.1715944001348; Fri, 17 May 2024 04:06:41 -0700 (PDT) Received: from localhost (fpd11144dd.ap.nuro.jp. [209.17.68.221]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f09363ac7dsm50255295ad.93.2024.05.17.04.06.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 04:06:40 -0700 (PDT) Date: Fri, 17 May 2024 20:06:38 +0900 From: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= To: Manivannan Sadhasivam Cc: Kishon Vijay Abraham I , Bjorn Helgaas , Lorenzo Pieralisi , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Niklas Cassel , Dan Carpenter Subject: Re: [PATCH v2 1/2] PCI: endpoint: pci-epf-test: Make use of cached 'epc_features' in pci_epf_test_core_init() Message-ID: <20240517110638.GM202520@rocinante> References: <20240418-pci-epf-test-fix-v2-0-eacd54831444@linaro.org> <20240418-pci-epf-test-fix-v2-1-eacd54831444@linaro.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <20240418-pci-epf-test-fix-v2-1-eacd54831444@linaro.org> Hello, > Instead of getting the epc_features from pci_epc_get_features() API, use > the cached pci_epf_test::epc_features value to avoid the NULL check. Since > the NULL check is already performed in pci_epf_test_bind(), having one more > check in pci_epf_test_core_init() is redundant and it is not possible to > hit the NULL pointer dereference. > > Also with commit a01e7214bef9 ("PCI: endpoint: Remove "core_init_notifier" > flag"), 'epc_features' got dereferenced without the NULL check, leading to > the following false positive smatch warning: > > drivers/pci/endpoint/functions/pci-epf-test.c:784 pci_epf_test_core_init() > error: we previously assumed 'epc_features' could be null (see line 747) > > So let's remove the redundant NULL check and also use the epc_features:: > {msix_capable/msi_capable} flags directly to avoid local variables. Applied to endpoint, thank you! [01/02] PCI: endpoint: pci-epf-test: Make use of cached 'epc_features' in pci_epf_test_core_init() https://git.kernel.org/pci/pci/c/3acb072c2433 [02/02] PCI: endpoint: pci-epf-test: Use 'msix_capable' flag directly in pci_epf_test_alloc_space() https://git.kernel.org/pci/pci/c/e79d1b1eb626 Krzysztof