[PATCH] stm: ltdc: fix two incorrect NULL checks on list iterator

Philippe CORNU philippe.cornu at foss.st.com
Thu Apr 7 09:01:19 UTC 2022



On 3/28/22 14:37, Raphael Gallais-Pou wrote:
> 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
> 

Applied on drm-misc-next.
Many thanks for your patch,
Philippe :-)


More information about the dri-devel mailing list