Skip to contentSkip to conversation

drm/msm: Add SDM845 DPU support

bug report Dan Carpenter 2 participants 4 messages Oct 1, 2021 – Oct 19, 2021 Arm Qualcomm mailing list

lore
Share & tools
lore
#0 lore raw

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;
                ^^^^^^^^^

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.

423 return;
424

regards,
dan carpenter

#1 lore raw
Quoted 17 lines · Dan Carpenter

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;
                ^^^^^^^^^

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.

Quoted 9 lines
   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

#2 lore raw

Hey Dan,

Thanks for the report, will take care of it.

Quoted 32 lines · Dan Carpenter
Quoted 22 lines · Dan Carpenter

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;
                ^^^^^^^^^

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
                    ^^^^^^^^^^^^^^^^^^^^
Quoted 8 lines

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.

Quoted 7 lines

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

Best,
Jessica Zhang

#3 lore raw
In reply to Dan Carpenter

Hey Dan,

Quoted 8 lines · Dan Carpenter
Quoted 7 lines · Dan Carpenter

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:

Quoted 6 lines
Quoted 6 lines
     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

Quoted 21 lines
Quoted 4 lines

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.

Quoted 9 lines
    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