提交 0109c2c4 编写于 作者: M mark gross 提交者: Rafael J. Wysocki

PM QoS: Correct pr_debug() misuse and improve parameter checks

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: Nmark gross <markgross@thegnar.org>
Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
上级 152e1d59
...@@ -389,10 +389,12 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, ...@@ -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') */ } else if (count == 11) { /* len('0x12345678/0') */
if (copy_from_user(ascii_value, buf, 11)) if (copy_from_user(ascii_value, buf, 11))
return -EFAULT; return -EFAULT;
if (strlen(ascii_value) != 10)
return -EINVAL;
x = sscanf(ascii_value, "%x", &value); x = sscanf(ascii_value, "%x", &value);
if (x != 1) if (x != 1)
return -EINVAL; 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 } else
return -EINVAL; return -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册