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>] [day] [month] [year] [list]
Date:	Wed, 4 Apr 2012 14:22:40 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Richard Purdie <rpurdie@...ys.net>,
	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch] leds: lm3556: fix fallout from checkpatch fixes

Patch 476b78f277 "leds-add-led-driver-for-lm3556-chip-checkpatch-fixes"
introduces a bug where we use "after" without initializing it.

In the original code, "count" and "after" were used to tell if
simple_strtoul() found a valid number.  Now that we've changed it to
kstrtoul(), we can just get rid of both variables.  It makes the whole
function simpler.

Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>

diff --git a/drivers/leds/leds-lm3556.c b/drivers/leds/leds-lm3556.c
index 64e751c..886a5d3 100644
--- a/drivers/leds/leds-lm3556.c
+++ b/drivers/leds/leds-lm3556.c
@@ -316,31 +316,23 @@ static ssize_t lm3556_indicator_pattern_store(struct device *dev,
 					      struct device_attribute *devAttr,
 					      const char *buf, size_t size)
 {
-	char *after;
-	ssize_t ret;
 	struct i2c_client *client = container_of(dev->parent,
 						 struct i2c_client, dev);
 	unsigned long state;
-	size_t count = after - buf;
+	int ret;
 
 	ret = kstrtoul(buf, 10, &state);
 	if (ret)
 		goto out;
-	if (isspace(*after))
-		count++;
-
-	if (count == size) {
-		ret = count;
-
-		if (state > INDIC_PATTERN_SIZE - 1)
-			state = INDIC_PATTERN_SIZE - 1;
-		lm3556_write_reg(client, REG_INDIC_BLINK,
-				 indicator_pattern[state].blinking);
-		lm3556_write_reg(client, REG_INDIC_PERIOD,
-				 indicator_pattern[state].period_cnt);
-	}
+
+	if (state > INDIC_PATTERN_SIZE - 1)
+		state = INDIC_PATTERN_SIZE - 1;
+	lm3556_write_reg(client, REG_INDIC_BLINK,
+			 indicator_pattern[state].blinking);
+	lm3556_write_reg(client, REG_INDIC_PERIOD,
+			 indicator_pattern[state].period_cnt);
 out:
-	return ret;
+	return size;
 }
 
 static DEVICE_ATTR(pattern, 0644, NULL, lm3556_indicator_pattern_store);
--
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