mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: 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
Cc: 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 04:17:35 -0700	[thread overview]
Message-ID: <1505906255.2153.3.camel@perches.com> (raw)
In-Reply-To: <15cec6eac63ffc9f12f1d16aff913eccad670f77.1505817563.git.arvind.yadav.cs@gmail.com>

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

  reply	other threads:[~2017-09-20 11:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20  6:59 Arvind Yadav
2017-09-20 11:17 ` Joe Perches [this message]
2017-09-20 14:49   ` Viresh Kumar
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=1505906255.2153.3.camel@perches.com \
    --to=joe@perches.com \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome