[Intel-gfx] [drm-intel:drm-intel-next-queued 6/7] drivers/gpu/drm/i915/display/intel_color.c:1576 ilk_read_lut_10() error: potential null dereference 'blob'. (drm_property_create_blob returns null)

Ville Syrjälä ville.syrjala at linux.intel.com
Fri Sep 20 18:13:18 UTC 2019


On Sat, Sep 21, 2019 at 01:55:25AM +0800, kbuild test robot wrote:
> tree:   git://anongit.freedesktop.org/drm-intel drm-intel-next-queued
> head:   4bb6a9d5d9a8289673c4cb0786d44be8a63c21db
> commit: 6b97b118d4d542c7bc25b725c6de3947fffb921b [6/7] drm/i915/display: Extract ilk_read_luts()
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp at intel.com>
> 
> New smatch warnings:
> drivers/gpu/drm/i915/display/intel_color.c:1576 ilk_read_lut_10() error: potential null dereference 'blob'.  (drm_property_create_blob returns null)

It never returns null. Not sure why this thing thinks otherwise.

> 
> Old smatch warnings:
> drivers/gpu/drm/i915/display/intel_color.c:1535 i9xx_read_lut_8() error: potential null dereference 'blob'.  (drm_property_create_blob returns null)
> 
> vim +/blob +1576 drivers/gpu/drm/i915/display/intel_color.c
> 
>   1558	
>   1559	static struct drm_property_blob *
>   1560	ilk_read_lut_10(const struct intel_crtc_state *crtc_state)
>   1561	{
>   1562		struct intel_crtc *crtc = to_intel_crtc(crtc_state->base.crtc);
>   1563		struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
>   1564		u32 lut_size = INTEL_INFO(dev_priv)->color.gamma_lut_size;
>   1565		enum pipe pipe = crtc->pipe;
>   1566		struct drm_property_blob *blob;
>   1567		struct drm_color_lut *blob_data;
>   1568		u32 i, val;
>   1569	
>   1570		blob = drm_property_create_blob(&dev_priv->drm,
>   1571						sizeof(struct drm_color_lut) * lut_size,
>   1572						NULL);
>   1573		if (IS_ERR(blob))
>   1574			return NULL;
>   1575	
> > 1576		blob_data = blob->data;
>   1577	
>   1578		for (i = 0; i < lut_size; i++) {
>   1579			val = I915_READ(PREC_PALETTE(pipe, i));
>   1580	
>   1581			blob_data[i].red = intel_color_lut_pack(REG_FIELD_GET(
>   1582								PREC_PALETTE_RED_MASK, val), 10);
>   1583			blob_data[i].green = intel_color_lut_pack(REG_FIELD_GET(
>   1584								  PREC_PALETTE_GREEN_MASK, val), 10);
>   1585			blob_data[i].blue = intel_color_lut_pack(REG_FIELD_GET(
>   1586								 PREC_PALETTE_BLUE_MASK, val), 10);
>   1587		}
>   1588	
>   1589		return blob;
>   1590	}
>   1591	
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list