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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221107153108.5770-2-jundongsong1@gmail.com>
Date:   Mon,  7 Nov 2022 23:31:08 +0800
From:   JunDong Song <jundongsong1@...il.com>
To:     jingoohan1@...il.com, gustavo.pimentel@...opsys.com,
        lpieralisi@...nel.org
Cc:     robh@...nel.org, kw@...ux.com, bhelgaas@...gle.com,
        linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
        JunDong Song <jundongsong1@...il.com>
Subject: [PATCH 2/2] PCI: dwc-host: Add a warning to prevent invalid values

of_pci_get_max_link_speed() may return a negative value,
causing the controller to not set the speed correctly.
Add a warning in case the driver engineer misses it.

Signed-off-by: JunDong Song <jundongsong1@...il.com>
---

When I use the pcie dwc driver, the controller speed is abnormal,
but it has not been detected because of the @max-link-speed error,
so I think I need to return an error or warning here.

Thanks.

 drivers/pci/controller/dwc/pcie-designware-host.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 39f3b37d4..0103b9a63 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -429,8 +429,11 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
 		pp->io_base = pci_pio_to_address(win->res->start);
 	}
 
-	if (pci->link_gen < 1)
+	if (pci->link_gen < 1) {
 		pci->link_gen = of_pci_get_max_link_speed(np);
+		if (unlikely(pci->link_gen < 0))
+			dev_warn(dev, "Failed to get max link speed\n");
+	}
 
 	/* Set default bus ops */
 	bridge->ops = &dw_pcie_ops;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ