[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <02eea90d-5a3a-415f-9123-36e81ff9511a@gmail.com>
Date: Sun, 7 Jan 2024 23:16:18 -0500
From: Luben Tuikov <ltuikov89@...il.com>
To: Markus Elfring <Markus.Elfring@....de>, dri-devel@...ts.freedesktop.org,
kernel-janitors@...r.kernel.org, Daniel Vetter <daniel@...ll.ch>,
David Airlie <airlied@...il.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>
Cc: LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: Re: [PATCH 1/2] drm/sched: One function call less in drm_sched_init()
after error detection
On 2023-12-26 10:56, Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Tue, 26 Dec 2023 16:30:25 +0100
>
> The kfree() function was called in one case by the
> drm_sched_init() function during error handling
> even if the passed data structure member contained a null pointer.
> This issue was detected by using the Coccinelle software.
>
> Thus adjust a jump target.
>
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
Thank you Markus for this patch.
Reviewed-by: Luben Tuikov <ltuikov89@...il.com>
Pushed to drm-misc-next.
--
Regards,
Luben
> ---
> drivers/gpu/drm/scheduler/sched_main.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 550492a7a031..b99d4e9ff109 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -1289,7 +1289,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
> sched->sched_rq = kmalloc_array(num_rqs, sizeof(*sched->sched_rq),
> GFP_KERNEL | __GFP_ZERO);
> if (!sched->sched_rq)
> - goto Out_free;
> + goto Out_check_own;
> sched->num_rqs = num_rqs;
> for (i = DRM_SCHED_PRIORITY_KERNEL; i < sched->num_rqs; i++) {
> sched->sched_rq[i] = kzalloc(sizeof(*sched->sched_rq[i]), GFP_KERNEL);
> @@ -1314,9 +1314,10 @@ int drm_sched_init(struct drm_gpu_scheduler *sched,
> Out_unroll:
> for (--i ; i >= DRM_SCHED_PRIORITY_KERNEL; i--)
> kfree(sched->sched_rq[i]);
> -Out_free:
> +
> kfree(sched->sched_rq);
> sched->sched_rq = NULL;
> +Out_check_own:
> if (sched->own_submit_wq)
> destroy_workqueue(sched->submit_wq);
> drm_err(sched, "%s: Failed to setup GPU scheduler--out of memory\n", __func__);
> --
> 2.43.0
>
Download attachment "OpenPGP_0x4C15479431A334AF.asc" of type "application/pgp-keys" (665 bytes)
Download attachment "OpenPGP_signature.asc" of type "application/pgp-signature" (237 bytes)
Powered by blists - more mailing lists