[PATCH 1/1] drm/exynos: Fix potential NULL pointer dereference in exynos_drm_encoder.c

Sachin Kamat sachin.kamat at linaro.org
Thu Nov 22 00:18:59 PST 2012


[snip]
>> >> And NULL pointer checking was already done above like below,
>> >>         if (overlay_ops && overlay_ops->disable)
>> >>                 overlay_ops->disable(manager->dev, zpos);
>> > Correct. But that check is applicable only for that one statement
>> > (overlay_ops->disable(manager->dev, zpos);).
>> >
>> > Similar check needs to be added to below 'if' code too.
>>
>> What are your comments about this?
>>
>
> Left condition first is checked so as I mentioned before, it doesn't need
> overlay_ops checking because that was checked already. why do you think
> overlay_ops should be checked again?
>

Consider the case when overlay_ops is NULL.

if (overlay_ops && overlay_ops->disable)
                 overlay_ops->disable(manager->dev, zpos);

It does not enter this condition as overlay_ops is NULL and moves to
the next statement,
if (overlay_ops->wait_for_vblank) where it gets dereferenced.

Please note we are not returning back from the first condition if
overlay_ops is NULL.
Hence we need to check the condition in second case too.

-- 
With warm regards,
Sachin


More information about the dri-devel mailing list