diff mbox

PM QoS: Allow parsing of ASCII values

Message ID 1297994096-1839-1-git-send-email-horms@verge.net.au (mailing list archive)
State Rejected, archived
Headers show

Commit Message

Simon Horman Feb. 18, 2011, 1:54 a.m. UTC
None
diff mbox

Patch

diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c
index aeaa7f8..98a34ea 100644
--- a/kernel/pm_qos_params.c
+++ b/kernel/pm_qos_params.c
@@ -387,10 +387,11 @@  static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
 	if (count == sizeof(s32)) {
 		if (copy_from_user(&value, buf, sizeof(s32)))
 			return -EFAULT;
-	} else if (count == 11) { /* len('0x12345678/0') */
-		if (copy_from_user(ascii_value, buf, 11))
+	} else if (count == 11 || count == 10) { /* len('0x12345678\n') or
+						  * len('0x12345678') */
+		if (copy_from_user(ascii_value, buf, count))
 			return -EFAULT;
-		if (strlen(ascii_value) != 10)
+		if (strlen(ascii_value) != count)
 			return -EINVAL;
 		x = sscanf(ascii_value, "%x", &value);
 		if (x != 1)