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]
Date:	Sun,  5 Dec 2010 19:49:35 +0200
From:	Alexey Dobriyan <adobriyan@...il.com>
To:	akpm@...ux-foundation.org
Cc:	linux-kernel@...r.kernel.org, Alexey Dobriyan <adobriyan@...il.com>
Subject: [PATCH 38/45] kstrtox: convert drivers/rtc/


Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
---
 drivers/rtc/rtc-pcf2123.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c
index 71bab0e..9e08179 100644
--- a/drivers/rtc/rtc-pcf2123.c
+++ b/drivers/rtc/rtc-pcf2123.c
@@ -87,13 +87,14 @@ static ssize_t pcf2123_show(struct device *dev, struct device_attribute *attr,
 	struct spi_device *spi = to_spi_device(dev);
 	struct pcf2123_sysfs_reg *r;
 	u8 txbuf[1], rxbuf[1];
-	unsigned long reg;
+	u8 reg;
 	int ret;
 
 	r = container_of(attr, struct pcf2123_sysfs_reg, attr);
 
-	if (strict_strtoul(r->name, 16, &reg))
-		return -EINVAL;
+	ret = kstrtou8(r->name, 16, &reg);
+	if (ret < 0)
+		return ret;
 
 	txbuf[0] = PCF2123_READ | reg;
 	ret = spi_write_then_read(spi, txbuf, 1, rxbuf, 1);
@@ -108,19 +109,17 @@ static ssize_t pcf2123_store(struct device *dev, struct device_attribute *attr,
 	struct spi_device *spi = to_spi_device(dev);
 	struct pcf2123_sysfs_reg *r;
 	u8 txbuf[2];
-	unsigned long reg;
-	unsigned long val;
-
 	int ret;
 
 	r = container_of(attr, struct pcf2123_sysfs_reg, attr);
 
-	if (strict_strtoul(r->name, 16, &reg)
-		|| strict_strtoul(buffer, 10, &val))
-		return -EINVAL;
-
-	txbuf[0] = PCF2123_WRITE | reg;
-	txbuf[1] = val;
+	ret = kstrtou8(r->name, 16, &txbuf[0]);
+	if (ret < 0)
+		return ret;
+	txbuf[0] |= PCF2123_WRITE;
+	ret = kstrtou8(buffer, 10, &txbuf[1]);
+	if (ret < 0)
+		return ret;
 	ret = spi_write(spi, txbuf, sizeof(txbuf));
 	if (ret < 0)
 		return -EIO;
-- 
1.7.2.2

--
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