Skip to content

Commit

Permalink
PM QoS: Correct pr_debug() misuse and improve parameter checks
Browse files Browse the repository at this point in the history
Correct some pr_debug() misuse and add a stronger parameter check to
pm_qos_write() for the ASCII hex value case.  Thanks to Dan Carpenter
for pointing out the problem!

Signed-off-by: mark gross <markgross@thegnar.org>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
  • Loading branch information
mark gross authored and Rafael J. Wysocki committed Sep 10, 2010
1 parent 152e1d5 commit 0109c2c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/pm_qos_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,12 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
} else if (count == 11) { /* len('0x12345678/0') */
if (copy_from_user(ascii_value, buf, 11))
return -EFAULT;
if (strlen(ascii_value) != 10)
return -EINVAL;
x = sscanf(ascii_value, "%x", &value);
if (x != 1)
return -EINVAL;
pr_debug(KERN_ERR "%s, %d, 0x%x\n", ascii_value, x, value);
pr_debug("%s, %d, 0x%x\n", ascii_value, x, value);
} else
return -EINVAL;

Expand Down

0 comments on commit 0109c2c

Please sign in to comment.