aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/pm_qos_params.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/pm_qos_params.c b/kernel/pm_qos_params.c
index d96b83ed21cb..3db49b9ca374 100644
--- a/kernel/pm_qos_params.c
+++ b/kernel/pm_qos_params.c
@@ -343,18 +343,18 @@ int pm_qos_remove_notifier(int pm_qos_class, struct notifier_block *notifier)
343} 343}
344EXPORT_SYMBOL_GPL(pm_qos_remove_notifier); 344EXPORT_SYMBOL_GPL(pm_qos_remove_notifier);
345 345
346#define PID_NAME_LEN sizeof("process_1234567890") 346#define PID_NAME_LEN 32
347static char name[PID_NAME_LEN];
348 347
349static int pm_qos_power_open(struct inode *inode, struct file *filp) 348static int pm_qos_power_open(struct inode *inode, struct file *filp)
350{ 349{
351 int ret; 350 int ret;
352 long pm_qos_class; 351 long pm_qos_class;
352 char name[PID_NAME_LEN];
353 353
354 pm_qos_class = find_pm_qos_object_by_minor(iminor(inode)); 354 pm_qos_class = find_pm_qos_object_by_minor(iminor(inode));
355 if (pm_qos_class >= 0) { 355 if (pm_qos_class >= 0) {
356 filp->private_data = (void *)pm_qos_class; 356 filp->private_data = (void *)pm_qos_class;
357 sprintf(name, "process_%d", current->pid); 357 snprintf(name, PID_NAME_LEN, "process_%d", current->pid);
358 ret = pm_qos_add_requirement(pm_qos_class, name, 358 ret = pm_qos_add_requirement(pm_qos_class, name,
359 PM_QOS_DEFAULT_VALUE); 359 PM_QOS_DEFAULT_VALUE);
360 if (ret >= 0) 360 if (ret >= 0)
@@ -366,9 +366,10 @@ static int pm_qos_power_open(struct inode *inode, struct file *filp)
366static int pm_qos_power_release(struct inode *inode, struct file *filp) 366static int pm_qos_power_release(struct inode *inode, struct file *filp)
367{ 367{
368 int pm_qos_class; 368 int pm_qos_class;
369 char name[PID_NAME_LEN];
369 370
370 pm_qos_class = (long)filp->private_data; 371 pm_qos_class = (long)filp->private_data;
371 sprintf(name, "process_%d", current->pid); 372 snprintf(name, PID_NAME_LEN, "process_%d", current->pid);
372 pm_qos_remove_requirement(pm_qos_class, name); 373 pm_qos_remove_requirement(pm_qos_class, name);
373 374
374 return 0; 375 return 0;
@@ -379,13 +380,14 @@ static ssize_t pm_qos_power_write(struct file *filp, const char __user *buf,
379{ 380{
380 s32 value; 381 s32 value;
381 int pm_qos_class; 382 int pm_qos_class;
383 char name[PID_NAME_LEN];
382 384
383 pm_qos_class = (long)filp->private_data; 385 pm_qos_class = (long)filp->private_data;
384 if (count != sizeof(s32)) 386 if (count != sizeof(s32))
385 return -EINVAL; 387 return -EINVAL;
386 if (copy_from_user(&value, buf, sizeof(s32))) 388 if (copy_from_user(&value, buf, sizeof(s32)))
387 return -EFAULT; 389 return -EFAULT;
388 sprintf(name, "process_%d", current->pid); 390 snprintf(name, PID_NAME_LEN, "process_%d", current->pid);
389 pm_qos_update_requirement(pm_qos_class, name, value); 391 pm_qos_update_requirement(pm_qos_class, name, value);
390 392
391 return sizeof(s32); 393 return sizeof(s32);