2024-06-10 10:51:20

by Amjad Ouled-Ameur

[permalink] [raw]
Subject: [PATCH] drm/komeda: check for error-valued pointer

komeda_pipeline_get_state() may return an error-valued pointer, thus
check the pointer for negative or null value before dereferencing.

Signed-off-by: Amjad Ouled-Ameur <[email protected]>
---
drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
index f3e744172673..f4e76b46ca32 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c
@@ -259,7 +259,7 @@ komeda_component_get_avail_scaler(struct komeda_component *c,
u32 avail_scalers;

pipe_st = komeda_pipeline_get_state(c->pipeline, state);
- if (!pipe_st)
+ if (IS_ERR_OR_NULL(pipe_st))
return NULL;

avail_scalers = (pipe_st->active_comps & KOMEDA_PIPELINE_SCALERS) ^
--
2.25.1



2024-06-10 11:22:48

by Maxime Ripard

[permalink] [raw]
Subject: Re: [PATCH] drm/komeda: check for error-valued pointer

On Mon, Jun 10, 2024 at 11:20:56AM GMT, Amjad Ouled-Ameur wrote:
> komeda_pipeline_get_state() may return an error-valued pointer, thus
> check the pointer for negative or null value before dereferencing.
>
> Signed-off-by: Amjad Ouled-Ameur <[email protected]>

I've added a Fixes tag and applied to drm-misc-fixes, thanks!
Maxime


Attachments:
(No filename) (349.00 B)
signature.asc (235.00 B)
Download all attachments

2024-06-12 07:56:05

by Maxime Ripard

[permalink] [raw]
Subject: Re: (subset) [PATCH] drm/komeda: check for error-valued pointer

On Mon, 10 Jun 2024 11:20:56 +0100, Amjad Ouled-Ameur wrote:
> komeda_pipeline_get_state() may return an error-valued pointer, thus
> check the pointer for negative or null value before dereferencing.
>
>

Applied to misc/kernel.git (drm-misc-fixes).

Thanks!
Maxime