All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: linux-kernel@vger.kernel.org, jonathanh@nvidia.com,
	thierry.reding@gmail.com, dri-devel@lists.freedesktop.org,
	daniel.vetter@intel.com
Subject: Re: [PATCH 1/2] drm: tegra: dc: Handle return value of kasprintf
Date: Thu, 21 Sep 2017 14:22:11 +0300	[thread overview]
Message-ID: <20170921112211.GG4914@intel.com> (raw)
In-Reply-To: <1505892308-6843-2-git-send-email-arvind.yadav.cs@gmail.com>

On Wed, Sep 20, 2017 at 12:55:07PM +0530, Arvind Yadav wrote:
> kasprintf() can fail here and we must check its return value.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/gpu/drm/tegra/dc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 4df3911..f3214a1 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -1695,6 +1695,8 @@ static int tegra_dc_debugfs_init(struct tegra_dc *dc, struct drm_minor *minor)
>  	int err;
>  
>  	name = kasprintf(GFP_KERNEL, "dc.%d", dc->pipe);
> +	if (!name)
> +		return -ENOMEM;
>  	dc->debugfs = debugfs_create_dir(name, minor->debugfs_root);

Indeed, doesn't look like debugfs_create_dir() can be safely called w/
name==NULL.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  	kfree(name);
>  
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: thierry.reding@gmail.com, airlied@linux.ie, jonathanh@nvidia.com,
	daniel.vetter@intel.com, jani.nikula@linux.intel.com,
	seanpaul@chromium.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm: tegra: dc: Handle return value of kasprintf
Date: Thu, 21 Sep 2017 14:22:11 +0300	[thread overview]
Message-ID: <20170921112211.GG4914@intel.com> (raw)
In-Reply-To: <1505892308-6843-2-git-send-email-arvind.yadav.cs@gmail.com>

On Wed, Sep 20, 2017 at 12:55:07PM +0530, Arvind Yadav wrote:
> kasprintf() can fail here and we must check its return value.
> 
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
>  drivers/gpu/drm/tegra/dc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 4df3911..f3214a1 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -1695,6 +1695,8 @@ static int tegra_dc_debugfs_init(struct tegra_dc *dc, struct drm_minor *minor)
>  	int err;
>  
>  	name = kasprintf(GFP_KERNEL, "dc.%d", dc->pipe);
> +	if (!name)
> +		return -ENOMEM;
>  	dc->debugfs = debugfs_create_dir(name, minor->debugfs_root);

Indeed, doesn't look like debugfs_create_dir() can be safely called w/
name==NULL.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  	kfree(name);
>  
> -- 
> 1.9.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2017-09-21 11:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-20  7:25 [PATCH 0/2] Handle / Release memory obtained by kasprintf Arvind Yadav
2017-09-20  7:25 ` [PATCH 1/2] drm: tegra: dc: Handle return value of kasprintf Arvind Yadav
2017-09-21 11:22   ` Ville Syrjälä [this message]
2017-09-21 11:22     ` Ville Syrjälä
2017-09-20  7:25 ` [PATCH 2/2] drm: Release memory obtained by kasprintf Arvind Yadav
2017-09-21 11:24   ` Ville Syrjälä
2017-09-21 11:24     ` Ville Syrjälä

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=20170921112211.GG4914@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    /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.