Message ID | 1b762a93-e1b2-4af3-8c04-c8843905c279@stanley.mountain (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Krzysztof Wilczyński |
Headers | show |
Series | PCI: keystone: Fix && vs || typo | expand |
On Fri, Jul 19, 2024 at 06:53:26PM -0500, Dan Carpenter wrote: > This code accidentally uses && where || was intended. It potentially > results in a NULL dereference. > > Fixes: 86f271f22bbb ("PCI: keystone: Add workaround for Errata #i2037 (AM65x SR 1.0)") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Thank you for the fix. Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com> Regards, Siddharth.
On Fri, Jul 19, 2024 at 06:53:26PM -0500, Dan Carpenter wrote: > This code accidentally uses && where || was intended. It potentially > results in a NULL dereference. > > Fixes: 86f271f22bbb ("PCI: keystone: Add workaround for Errata #i2037 (AM65x SR 1.0)") > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> - Mani > --- > drivers/pci/controller/dwc/pci-keystone.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c > index 52c6420ae200..95a471d6a586 100644 > --- a/drivers/pci/controller/dwc/pci-keystone.c > +++ b/drivers/pci/controller/dwc/pci-keystone.c > @@ -577,7 +577,7 @@ static void ks_pcie_quirk(struct pci_dev *dev) > */ > if (pci_match_id(am6_pci_devids, bridge)) { > bridge_dev = pci_get_host_bridge_device(dev); > - if (!bridge_dev && !bridge_dev->parent) > + if (!bridge_dev || !bridge_dev->parent) > return; > > ks_pcie = dev_get_drvdata(bridge_dev->parent); > -- > 2.43.0 >
Hello, > This code accidentally uses && where || was intended. It potentially > results in a NULL dereference. Applied to controller/keystone, thank you! [1/1] PCI: keystone: Fix if-statement expression in ks_pcie_quirk() https://git.kernel.org/pci/pci/c/6188a1c762eb Krzysztof
diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index 52c6420ae200..95a471d6a586 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -577,7 +577,7 @@ static void ks_pcie_quirk(struct pci_dev *dev) */ if (pci_match_id(am6_pci_devids, bridge)) { bridge_dev = pci_get_host_bridge_device(dev); - if (!bridge_dev && !bridge_dev->parent) + if (!bridge_dev || !bridge_dev->parent) return; ks_pcie = dev_get_drvdata(bridge_dev->parent);
This code accidentally uses && where || was intended. It potentially results in a NULL dereference. Fixes: 86f271f22bbb ("PCI: keystone: Add workaround for Errata #i2037 (AM65x SR 1.0)") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> --- drivers/pci/controller/dwc/pci-keystone.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)