From: Viresh Kumar <viresh.kumar@linaro.org>
To: Joe Perches <joe@perches.com>
Cc: Arvind Yadav <arvind.yadav.cs@gmail.com>,
vireshk@kernel.org, nm@ti.com, sboyd@codeaurora.org,
rjw@rjwysocki.net, pavel@ucw.cz, len.brown@intel.com,
gregkh@linuxfoundation.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PM / OPP: Handle return value of kasprintf
Date: Wed, 20 Sep 2017 07:49:02 -0700 [thread overview]
Message-ID: <20170920144902.GL30848@ubuntu> (raw)
In-Reply-To: <1505906255.2153.3.camel@perches.com>
On 20-09-17, 04:17, Joe Perches wrote:
> 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
Sure.
@Arvind: I will let you write that patch.
--
viresh
next prev parent reply other threads:[~2017-09-20 14:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 6:59 [PATCH] PM / OPP: Handle return value of kasprintf Arvind Yadav
2017-09-20 11:17 ` Joe Perches
2017-09-20 14:49 ` Viresh Kumar [this message]
2017-09-20 16:58 ` arvind
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170920144902.GL30848@ubuntu \
--to=viresh.kumar@linaro.org \
--cc=arvind.yadav.cs@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=sboyd@codeaurora.org \
--cc=vireshk@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.