Re: [PATCH] drm/v3d: Fix memory leak in v3d_submit_cl_ioctl

From: Markus Elfring
Date: Mon Oct 21 2019 - 16:40:44 EST


> In the impelementation of v3d_submit_cl_ioctl() there are two memory leaks.

Please avoid another typo also in this change description.


> â 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 âimperative moodâ be more appropriate for such wordings?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=7d194c2100ad2a6dded545887d02754948ca5241#n151


â
> +++ b/drivers/gpu/drm/v3d/v3d_gem.c
> @@ -557,13 +557,16 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
â
> if (ret) {
> v3d_job_put(&render->base);
> + kfree(bin);
â

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 here)?

Regards,
Markus