Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751707AbdIULWR (ORCPT ); Thu, 21 Sep 2017 07:22:17 -0400 Received: from mga14.intel.com ([192.55.52.115]:2763 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751550AbdIULWQ (ORCPT ); Thu, 21 Sep 2017 07:22:16 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,425,1500966000"; d="scan'208";a="137870028" Date: Thu, 21 Sep 2017 14:22:11 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Arvind Yadav 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 Message-ID: <20170921112211.GG4914@intel.com> References: <1505892308-6843-1-git-send-email-arvind.yadav.cs@gmail.com> <1505892308-6843-2-git-send-email-arvind.yadav.cs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1505892308-6843-2-git-send-email-arvind.yadav.cs@gmail.com> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1095 Lines: 38 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 > --- > 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? > 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