lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZiDITzuUXsTZ7U4T@ryzen>
Date: Thu, 18 Apr 2024 09:14:23 +0200
From: Niklas Cassel <cassel@...nel.org>
To: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Cc: Krzysztof WilczyƄski <kw@...ux.com>,
	Kishon Vijay Abraham I <kishon@...nel.org>,
	Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: [PATCH] PCI: endpoint: pci-epf-test: Make use of cached
 'epc_features' in pci_epf_test_core_init()

On Thu, Apr 18, 2024 at 12:23:08PM +0530, Manivannan Sadhasivam wrote:
> On Thu, Apr 18, 2024 at 08:46:47AM +0200, Niklas Cassel wrote:
> > On Thu, Apr 18, 2024 at 11:13:19AM +0530, Manivannan Sadhasivam wrote:
> > > On Wed, Apr 17, 2024 at 07:49:45PM +0200, Niklas Cassel wrote:
> > > > On Wed, Apr 17, 2024 at 10:47:25PM +0530, Manivannan Sadhasivam wrote:
> > > > > 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. This also leads to the following 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)
> > > > > 
> > > > > Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> > > > > Closes: https://lore.kernel.org/linux-pci/024b5826-7180-4076-ae08-57d2584cca3f@moroto.mountain/
> > > > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
> > > > 
> > > > I think you forgot:
> > > > Fixes: a01e7214bef9 ("PCI: endpoint: Remove "core_init_notifier" flag")
> > > > 
> > > 
> > > No, that's not the correct fixes tag I suppose. This redudant check is
> > > introduced by commit, 5e50ee27d4a5 ("PCI: pci-epf-test: Add support to defer
> > > core initialization") and this commit removes the redundant check (fixing smatch
> > > warning is a side effect). So if the fixes tag needs to be added, then this
> > > commit should be referenced.
> > 
> > Well, you have a Closes: tag that links to a bug report about a smatch
> > warning that was introduced with 5e50ee27d4a5 ("PCI: pci-epf-test: Add
> > support to defer core initialization").
> > 
> > So if you want to reference another commit, then you should probably
> > drop the Closes: tag.
> > 
> 
> Then checkpatch will complain... But I think I can keep the two tags? One is for
> fixing the redudant check and another is for the smatch warning reported.

Yes, I think so too.

You can have Fixes: to the commit that introduced the redundant check,
since this was obviously not the correct thing to do, and then perhaps
just mention commit 5e50ee27d4a5 ("PCI: pci-epf-test: Add support to
defer core initialization") somewhere in the commit log.


Kind regards,
Niklas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ