diff options
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/qos.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/kernel/power/qos.c b/kernel/power/qos.c index a394297f8b2f..8dff9b48075a 100644 --- a/kernel/power/qos.c +++ b/kernel/power/qos.c | |||
@@ -558,30 +558,12 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf, | |||
558 | if (count == sizeof(s32)) { | 558 | if (count == sizeof(s32)) { |
559 | if (copy_from_user(&value, buf, sizeof(s32))) | 559 | if (copy_from_user(&value, buf, sizeof(s32))) |
560 | return -EFAULT; | 560 | return -EFAULT; |
561 | } else if (count <= 11) { /* ASCII perhaps? */ | 561 | } else { |
562 | char ascii_value[11]; | ||
563 | unsigned long int ulval; | ||
564 | int ret; | 562 | int ret; |
565 | 563 | ||
566 | if (copy_from_user(ascii_value, buf, count)) | 564 | ret = kstrtos32_from_user(buf, count, 16, &value); |
567 | return -EFAULT; | 565 | if (ret) |
568 | 566 | return ret; | |
569 | if (count > 10) { | ||
570 | if (ascii_value[10] == '\n') | ||
571 | ascii_value[10] = '\0'; | ||
572 | else | ||
573 | return -EINVAL; | ||
574 | } else { | ||
575 | ascii_value[count] = '\0'; | ||
576 | } | ||
577 | ret = kstrtoul(ascii_value, 16, &ulval); | ||
578 | if (ret) { | ||
579 | pr_debug("%s, 0x%lx, 0x%x\n", ascii_value, ulval, ret); | ||
580 | return -EINVAL; | ||
581 | } | ||
582 | value = (s32)lower_32_bits(ulval); | ||
583 | } else { | ||
584 | return -EINVAL; | ||
585 | } | 567 | } |
586 | 568 | ||
587 | req = filp->private_data; | 569 | req = filp->private_data; |