From: Markus Elfring Subject: Re: [PATCH] drm/v3d: Fix memory leak in v3d_submit_cl_ioctl Date: Mon, 21 Oct 2019 22:40:22 +0200 Message-ID: References: <20191021185250.26130-1-navid.emamdoost@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20191021185250.26130-1-navid.emamdoost@gmail.com> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Navid Emamdoost , dri-devel@lists.freedesktop.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, Navid Emamdoost , Kangjie Lu , Stephen McCamant , Daniel Vetter , David Airlie , Eric Anholt List-Id: dri-devel@lists.freedesktop.org > In the impelementation of v3d_submit_cl_ioctl() there are two memory lea= ks. Please avoid another typo also in this change description. > =E2=80=A6 If kcalloc fails to allocate memory for bin then > render->base should be put. Also, if v3d_job_init() fails to initialize > bin->base then allocated memory for bin should be released. Will an =E2=80=9Cimperative mood=E2=80=9D be more appropriate for such wor= dings? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Do= cumentation/process/submitting-patches.rst?id=3D7d194c2100ad2a6dded545887d= 02754948ca5241#n151 =E2=80=A6 > +++ b/drivers/gpu/drm/v3d/v3d_gem.c > @@ -557,13 +557,16 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *= data, =E2=80=A6 > if (ret) { > v3d_job_put(&render->base); > + kfree(bin); =E2=80=A6 Can it be helpful to move the added function call before the other in this if branch (if you prefer to avoid the addition of a jump target he= re)? Regards, Markus