[Intel-gfx] [bug report] drm/i915: Replace some gamma_mode ifs with switches

Dan Carpenter dan.carpenter at oracle.com
Mon Nov 2 13:08:45 UTC 2020


Similar bug:

drivers/gpu/drm/i915/display/intel_color.c:794 bdw_load_luts() error: we previously assumed 'gamma_lut' could be null (see line 784)

regards,
dan carpenter

On Mon, Nov 02, 2020 at 04:07:36PM +0300, Dan Carpenter wrote:
> Hello Ville Syrjälä,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 7852ddd5d60a: "drm/i915: Replace some gamma_mode ifs with 
> switches" from Sep 25, 2020, leads to the following Smatch complaint:
> 
>     drivers/gpu/drm/i915/display/intel_color.c:765 ivb_load_luts()
>     error: we previously assumed 'gamma_lut' could be null (see line 755)
> 
> drivers/gpu/drm/i915/display/intel_color.c
>    754		const struct drm_property_blob *degamma_lut = crtc_state->hw.degamma_lut;
>    755		const struct drm_property_blob *blob = gamma_lut ?: degamma_lut;
>                                                        ^^^^^^^^^^^^
> Check for NULL
> 
>    756	
>    757		switch (crtc_state->gamma_mode) {
>    758		case GAMMA_MODE_MODE_8BIT:
>    759			ilk_load_lut_8(crtc, blob);
>    760			break;
>    761		case GAMMA_MODE_MODE_SPLIT:
>    762			ivb_load_lut_10(crtc, degamma_lut, PAL_PREC_SPLIT_MODE |
>    763					PAL_PREC_INDEX_VALUE(0));
>    764			ivb_load_lut_ext_max(crtc_state);
>    765			ivb_load_lut_10(crtc, gamma_lut, PAL_PREC_SPLIT_MODE |
>                                               ^^^^^^^^^
> Unchecked dereference.  Possibly pass "blob" here?
> 
>    766					PAL_PREC_INDEX_VALUE(512));
>    767			break;
> 
> regards,
> dan carpenter


More information about the Intel-gfx mailing list