[Intel-gfx] [PATCH 2/5] Critical-KlockWork-Fixes-intel_display.c-NullDeref

kernel test robot lkp at intel.com
Thu Aug 20 03:24:57 UTC 2020


Hi Nischal,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on v5.9-rc1 next-20200819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nischal-Varide/Critical-KclockWork-Fixes-intel_atomi-c-PossibleNull/20200819-193249
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>


cppcheck warnings: (new ones prefixed by >>)

        ^
   drivers/gpu/drm/i915/display/intel_display.c:4308:7: warning: Local variable src_w shadows outer variable [shadowVar]
     int src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
         ^
   drivers/gpu/drm/i915/display/intel_display.c:4271:20: note: Shadowed declaration
    int src_x, src_y, src_w;
                      ^
   drivers/gpu/drm/i915/display/intel_display.c:4308:7: note: Shadow variable
     int src_w = drm_rect_width(&plane_state->uapi.src) >> 16;
         ^
   drivers/gpu/drm/i915/display/intel_display.c:11169:7: warning: Local variable tmp shadows outer variable [shadowVar]
     u32 tmp = intel_de_read(dev_priv,
         ^
   drivers/gpu/drm/i915/display/intel_display.c:11133:6: note: Shadowed declaration
    u32 tmp;
        ^
   drivers/gpu/drm/i915/display/intel_display.c:11169:7: note: Shadow variable
     u32 tmp = intel_de_read(dev_priv,
         ^
   drivers/gpu/drm/i915/display/intel_display.c:14246:4: warning: Local variable __ret_warn_on shadows outer variable [shadowVar]
      I915_STATE_WARN(active,
      ^
   drivers/gpu/drm/i915/display/intel_display.c:14237:3: note: Shadowed declaration
     I915_STATE_WARN(!!encoder->base.crtc != enabled,
     ^
   drivers/gpu/drm/i915/display/intel_display.c:14246:4: note: Shadow variable
      I915_STATE_WARN(active,
      ^
   drivers/gpu/drm/i915/display/intel_display.c:14293:3: warning: Local variable __ret_warn_on shadows outer variable [shadowVar]
     I915_STATE_WARN(active != new_crtc_state->hw.active,
     ^
   drivers/gpu/drm/i915/display/intel_display.c:14279:2: note: Shadowed declaration
    I915_STATE_WARN(new_crtc_state->hw.active != active,
    ^
   drivers/gpu/drm/i915/display/intel_display.c:14293:3: note: Shadow variable
     I915_STATE_WARN(active != new_crtc_state->hw.active,
     ^
   drivers/gpu/drm/i915/display/intel_display.c:14298:3: warning: Local variable __ret_warn_on shadows outer variable [shadowVar]
     I915_STATE_WARN(active && crtc->pipe != pipe,
     ^
   drivers/gpu/drm/i915/display/intel_display.c:14279:2: note: Shadowed declaration
    I915_STATE_WARN(new_crtc_state->hw.active != active,
    ^
   drivers/gpu/drm/i915/display/intel_display.c:14298:3: note: Shadow variable
     I915_STATE_WARN(active && crtc->pipe != pipe,
     ^
   drivers/gpu/drm/i915/display/intel_display.c:14315:3: warning: Local variable __ret_warn_on shadows outer variable [shadowVar]
     I915_STATE_WARN(1, "pipe state doesn't match!n");
     ^
   drivers/gpu/drm/i915/display/intel_display.c:14279:2: note: Shadowed declaration
    I915_STATE_WARN(new_crtc_state->hw.active != active,
    ^
   drivers/gpu/drm/i915/display/intel_display.c:14315:3: note: Shadow variable
     I915_STATE_WARN(1, "pipe state doesn't match!n");
     ^
   drivers/gpu/drm/i915/display/intel_display.c:18447:23: warning: Local variable crtc shadows outer variable [shadowVar]
      struct intel_crtc *crtc;
                         ^
   drivers/gpu/drm/i915/display/intel_display.c:18385:21: note: Shadowed declaration
    struct intel_crtc *crtc;
                       ^
   drivers/gpu/drm/i915/display/intel_display.c:18447:23: note: Shadow variable
      struct intel_crtc *crtc;
                         ^
   drivers/gpu/drm/i915/display/intel_display.c:6103:35: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
    scaler_state->scaler_users |= (1 << scaler_user);
                                     ^
   drivers/gpu/drm/i915/display/intel_display.c:6127:6: note: Calling function 'skl_update_scaler', 3rd argument '31' value is 31
        SKL_CRTC_INDEX,
        ^
   drivers/gpu/drm/i915/display/intel_display.c:6103:35: note: Shift
    scaler_state->scaler_users |= (1 << scaler_user);
                                     ^
   drivers/gpu/drm/i915/display/intel_display.c:10477:36: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
     scaler_state->scaler_users |= (1 << SKL_CRTC_INDEX);
                                      ^
   drivers/gpu/drm/i915/display/intel_display.c:10479:37: warning: Shifting signed 32-bit value by 31 bits is undefined behaviour [shiftTooManyBitsSigned]
     scaler_state->scaler_users &= ~(1 << SKL_CRTC_INDEX);
                                       ^
>> drivers/gpu/drm/i915/display/intel_display.c:11280:9: warning: Uninitialized variable: base [uninitvar]
    return base + plane_state->color_plane[0].offset;
           ^

# https://github.com/0day-ci/linux/commit/5d862961b8571914f726e947570316016ec67c5d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nischal-Varide/Critical-KclockWork-Fixes-intel_atomi-c-PossibleNull/20200819-193249
git checkout 5d862961b8571914f726e947570316016ec67c5d
vim +11280 drivers/gpu/drm/i915/display/intel_display.c

0e8ffe1bf81b07 drivers/gpu/drm/i915/intel_display.c         Daniel Vetter         2013-03-28  11263  
cd5dcbf1b26c60 drivers/gpu/drm/i915/intel_display.c         Ville Syrjälä         2017-03-27  11264  static u32 intel_cursor_base(const struct intel_plane_state *plane_state)
1cecc830e6b662 drivers/gpu/drm/i915/intel_display.c         Ville Syrjälä         2017-03-27  11265  {
1cecc830e6b662 drivers/gpu/drm/i915/intel_display.c         Ville Syrjälä         2017-03-27  11266  	struct drm_i915_private *dev_priv =
f90a85e76c2a89 drivers/gpu/drm/i915/display/intel_display.c Maarten Lankhorst     2019-10-31  11267  		to_i915(plane_state->uapi.plane->dev);
7b3cb17a48dc1b drivers/gpu/drm/i915/display/intel_display.c Maarten Lankhorst     2019-10-31  11268  	const struct drm_framebuffer *fb = plane_state->hw.fb;
1cecc830e6b662 drivers/gpu/drm/i915/intel_display.c         Ville Syrjälä         2017-03-27  11269  	const struct drm_i915_gem_object *obj = intel_fb_obj(fb);
1cecc830e6b662 drivers/gpu/drm/i915/intel_display.c         Ville Syrjälä         2017-03-27  11270  	u32 base;
1cecc830e6b662 drivers/gpu/drm/i915/intel_display.c         Ville Syrjälä         2017-03-27  11271  
5d862961b85719 drivers/gpu/drm/i915/display/intel_display.c Nischal Varide        2020-08-19  11272  	if (obj) {
5d862961b85719 drivers/gpu/drm/i915/display/intel_display.c Nischal Varide        2020-08-19  11273  
d53db442db36fd drivers/gpu/drm/i915/intel_display.c         José Roberto de Souza 2018-11-30  11274  		if (INTEL_INFO(dev_priv)->display.cursor_needs_physical)
c6790dc22312f5 drivers/gpu/drm/i915/display/intel_display.c Chris Wilson          2020-02-02  11275  			base = sg_dma_address(obj->mm.pages->sgl);
1cecc830e6b662 drivers/gpu/drm/i915/intel_display.c         Ville Syrjälä         2017-03-27  11276  		else
1cecc830e6b662 drivers/gpu/drm/i915/intel_display.c         Ville Syrjälä         2017-03-27  11277  			base = intel_plane_ggtt_offset(plane_state);
5d862961b85719 drivers/gpu/drm/i915/display/intel_display.c Nischal Varide        2020-08-19  11278  	}
1cecc830e6b662 drivers/gpu/drm/i915/intel_display.c         Ville Syrjälä         2017-03-27  11279  
30a027dcccc270 drivers/gpu/drm/i915/display/intel_display.c Ville Syrjälä         2019-10-15 @11280  	return base + plane_state->color_plane[0].offset;
1cecc830e6b662 drivers/gpu/drm/i915/intel_display.c         Ville Syrjälä         2017-03-27  11281  }
1cecc830e6b662 drivers/gpu/drm/i915/intel_display.c         Ville Syrjälä         2017-03-27  11282  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


More information about the Intel-gfx mailing list