lkml.org 
[lkml]   [2017]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] drm: tegra: dc: Handle return value of kasprintf
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

\
 
 \ /
  Last update: 2017-09-21 19:30    [W:0.048 / U:0.352 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site