lkml.org 
[lkml]   [2017]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] PM / OPP: Handle return value of kasprintf
From
Date
On Wed, 2017-09-20 at 12:29 +0530, Arvind Yadav wrote:
> kasprintf() can fail here and we must check its return value.
[]
> diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c
[]
> @@ -45,7 +45,8 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
>
> for (i = 0; i < opp_table->regulator_count; i++) {
> name = kasprintf(GFP_KERNEL, "supply-%d", i);
> -
> + if (!name)
> + return false;
> /* Create per-opp directory */
> d = debugfs_create_dir(name, pdentry);

Probably more sensible to avoid the kasprintf/kfree
and just have
char name[20];
on the stack

\
 
 \ /
  Last update: 2017-09-20 13:18    [W:0.084 / U:0.144 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site