linux-stable/drivers/gpu/drm/stm
Xiaomeng Tong 8d37abe2c0 stm: ltdc: fix two incorrect NULL checks on list iterator
commit 2e6c86be0e upstream.

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@vger.kernel.org
Fixes: 99e360442f ("drm/stm: Fix bus_flags handling")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Acked-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220327055355.3808-1-xiam0nd.tong@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:26:28 +02:00
..
drv.c drm/<drivers>: Constify struct drm_driver 2020-11-06 10:31:26 +01:00
dw_mipi_dsi-stm.c drm/stm: dsi: compute the transition time from LP to HS and back 2021-07-19 15:35:55 +02:00
Kconfig drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
ltdc.c stm: ltdc: fix two incorrect NULL checks on list iterator 2022-06-09 10:26:28 +02:00
ltdc.h drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position() 2020-02-13 13:09:22 +01:00
Makefile