[PATCH] stm: ltdc: fix two incorrect NULL checks on list iterator
Raphael Gallais-Pou
raphael.gallais-pou at foss.st.com
Mon Mar 28 12:37:37 UTC 2022
Hello Xiaomeng
On 3/27/22 07:53, Xiaomeng Tong wrote:
> The two bugs are here:
> if (encoder) {
> if (bridge && bridge->timings)
>
> The list iterator value 'encoder/bridge' will *always* be set and
> non-NULL by drm_for_each_encoder()/list_for_each_entry(), so it is
> incorrect to assume that the iterator value will be NULL if the
> list is empty or no element is found.
>
> To fix the bug, use a new variable '*_iter' as the list iterator,
> while use the old variable 'encoder/bridge' as a dedicated pointer
> to point to the found element.
>
> Cc: stable at vger.kernel.org
> Fixes: 99e360442f223 ("drm/stm: Fix bus_flags handling")
> Signed-off-by: Xiaomeng Tong <xiam0nd.tong at gmail.com>
> ---
> drivers/gpu/drm/stm/ltdc.c | 16 ++++++++++------
> 1 file changed, 10 insertions(+), 6 deletions(-)
Thanks for your fix
Acked-by: Raphael Gallais-Pou <raphael.gallais-pou at foss.st.com>
Raphaël Gallais-Pou
More information about the dri-devel
mailing list