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>] [day] [month] [year] [list]
Date:	Tue, 17 Oct 2006 15:24:49 +0900
From:	Akinobu Mita <akinobu.mita@...il.com>
To:	linux-kernel@...r.kernel.org
Cc:	Greg Kroah-Hartman <gregkh@...e.de>,
	Jean Delvare <khali@...ux-fr.org>
Subject: [PATCH] i2c: Fix return value check

class_device_create() returns error code as pointer on failure.
This patch checks the return value of class_device_create() by using IS_ERR().

Cc: Greg Kroah-Hartman <gregkh@...e.de>
Cc: Jean Delvare <khali@...ux-fr.org>
Signed-off-by: Akinbou Mita <akinobu.mita@...il.com>

 drivers/i2c/i2c-dev.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: 2.6-rc/drivers/i2c/i2c-dev.c
===================================================================
--- 2.6-rc.orig/drivers/i2c/i2c-dev.c
+++ 2.6-rc/drivers/i2c/i2c-dev.c
@@ -417,8 +417,8 @@ static int i2cdev_attach_adapter(struct 
 						 MKDEV(I2C_MAJOR, adap->nr),
 						 &adap->dev, "i2c-%d",
 						 adap->nr);
-	if (!i2c_dev->class_dev) {
-		res = -ENODEV;
+	if (IS_ERR(i2c_dev->class_dev)) {
+		res = PTR_ERR(i2c_dev->class_dev);
 		goto error;
 	}
 	res = class_device_create_file(i2c_dev->class_dev, &class_device_attr_name);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ