[bug report] drm/msm: Add SDM845 DPU support

Jessica Zhang jesszhan at codeaurora.org
Tue Oct 19 23:37:48 UTC 2021


Hey Dan,

On 10/1/2021 6:50 AM, Dan Carpenter wrote:
> On Fri, Oct 01, 2021 at 04:49:12PM +0300, Dan Carpenter wrote:
>> Hello Jeykumar Sankaran,
>>
>> This is a semi-automatic email about new static checker warnings.
>>
>> The patch 25fdd5933e4c: "drm/msm: Add SDM845 DPU support" from Jun
>> 27, 2018, leads to the following Smatch complaint:
>>
>>      drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c:422 _dpu_hw_sspp_setup_scaler3()
>>      warn: variable dereferenced before check 'ctx->cap->sblk' (see line 421)
>>
>> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
>>     420		(void)pe;
>>                  ^^^^^^^^^

Got it. I'll take care of the null pointer issues, but planning to 
address the `(void)pe` issue in this patch: 
https://patchwork.freedesktop.org/patch/456592/

Thanks,

Jessica Zhang

>> You should file a bug report with your compiler devs instead of adding
>> these sorts of statements to your code.  This function is used as a
>> function pointer so unused parameters are normal.
>>
>>     421		if (_sspp_subblk_offset(ctx, DPU_SSPP_SCALER_QSEED3, &idx) || !sspp
>>                      ^^^^^^^^^^^^^^^^^^^^
>> The _sspp_subblk_offset() dereferenced "ctx" before it is checked and
>> then it also derefereces "ctx->cap->sblk" without checking.
>>
>>     422			|| !scaler3_cfg || !ctx || !ctx->cap || !ctx->cap->sblk)
>>                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> So these will have already crashed before we reach this point.
>>
> Same thing later as well.
>
> drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c:591 dpu_hw_sspp_setup_creq_lut()
> warn: variable dereferenced before check 'ctx->cap' (see line 588)
>
> regards,
> dan carpenter
>


More information about the dri-devel mailing list