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: <20200608160544.7134-3-eajames@linux.ibm.com>
Date:   Mon,  8 Jun 2020 11:05:44 -0500
From:   Eddie James <eajames@...ux.ibm.com>
To:     linux-i2c@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, andy.shevchenko@...il.com,
        wsa@...nel.org, joel@....id.au, eajames@...ux.ibm.com
Subject: [PATCH 2/2] i2c: fsi: Prevent adding adapters for ports without dts nodes

Ports should be defined in the devicetree if they are to be enabled on
the system.

Signed-off-by: Eddie James <eajames@...ux.ibm.com>
Signed-off-by: Joel Stanley <joel@....id.au>
---
 drivers/i2c/busses/i2c-fsi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
index 977d6f524649..95b6b6bc1d78 100644
--- a/drivers/i2c/busses/i2c-fsi.c
+++ b/drivers/i2c/busses/i2c-fsi.c
@@ -703,7 +703,12 @@ static int fsi_i2c_probe(struct device *dev)
 
 	for (port_no = 0; port_no < ports; port_no++) {
 		np = fsi_i2c_find_port_of_node(dev->of_node, port_no);
-		if (np && !of_device_is_available(np))
+		/* Do not add port if it is not described in the device tree */
+		if (!np)
+			continue;
+
+		/* Do not add port if it is described as disabled */
+		if (!of_device_is_available(np))
 			continue;
 
 		port = kzalloc(sizeof(*port), GFP_KERNEL);
-- 
2.24.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ