WSL2-Linux-Kernel/drivers/gpu/drm/stm
Xiaomeng Tong 2037d8cf8c 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:23:28 +02:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +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
ltdc.c stm: ltdc: fix two incorrect NULL checks on list iterator 2022-06-09 10:23: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