[kbuild] Re: [PATCH v4 09/11] drm/i915: migrate skl planes code new file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jani,

url:    https://github.com/0day-ci/linux/commits/Jani-Nikula/drm-i915-refactor-intel-display/20201216-194754 
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-m001-20201216 (attached as .config)
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@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/gpu/drm/i915/display/intel_gen9_plane.c:712 skl_update_scaler_plane() error: we previously assumed 'fb' could be null (see line 696)

vim +/fb +712 drivers/gpu/drm/i915/display/intel_gen9_plane.c

44f5af76b2fd05e Dave Airlie 2020-12-16  672  int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
44f5af76b2fd05e Dave Airlie 2020-12-16  673  			    struct intel_plane_state *plane_state)
44f5af76b2fd05e Dave Airlie 2020-12-16  674  {
44f5af76b2fd05e Dave Airlie 2020-12-16  675  	struct intel_plane *intel_plane =
44f5af76b2fd05e Dave Airlie 2020-12-16  676  		to_intel_plane(plane_state->uapi.plane);
44f5af76b2fd05e Dave Airlie 2020-12-16  677  	struct drm_i915_private *dev_priv = to_i915(intel_plane->base.dev);
44f5af76b2fd05e Dave Airlie 2020-12-16  678  	struct drm_framebuffer *fb = plane_state->hw.fb;
44f5af76b2fd05e Dave Airlie 2020-12-16  679  	int ret;
44f5af76b2fd05e Dave Airlie 2020-12-16  680  	bool force_detach = !fb || !plane_state->uapi.visible;
44f5af76b2fd05e Dave Airlie 2020-12-16  681  	bool need_scaler = false;
44f5af76b2fd05e Dave Airlie 2020-12-16  682  
44f5af76b2fd05e Dave Airlie 2020-12-16  683  	/* Pre-gen11 and SDR planes always need a scaler for planar formats. */
44f5af76b2fd05e Dave Airlie 2020-12-16  684  	if (!icl_is_hdr_plane(dev_priv, intel_plane->id) &&
44f5af76b2fd05e Dave Airlie 2020-12-16  685  	    fb && intel_format_info_is_yuv_semiplanar(fb->format, fb->modifier))
44f5af76b2fd05e Dave Airlie 2020-12-16  686  		need_scaler = true;
44f5af76b2fd05e Dave Airlie 2020-12-16  687  
44f5af76b2fd05e Dave Airlie 2020-12-16  688  	ret = skl_update_scaler(crtc_state, force_detach,
44f5af76b2fd05e Dave Airlie 2020-12-16  689  				drm_plane_index(&intel_plane->base),
44f5af76b2fd05e Dave Airlie 2020-12-16  690  				&plane_state->scaler_id,
44f5af76b2fd05e Dave Airlie 2020-12-16  691  				drm_rect_width(&plane_state->uapi.src) >> 16,
44f5af76b2fd05e Dave Airlie 2020-12-16  692  				drm_rect_height(&plane_state->uapi.src) >> 16,
44f5af76b2fd05e Dave Airlie 2020-12-16  693  				drm_rect_width(&plane_state->uapi.dst),
44f5af76b2fd05e Dave Airlie 2020-12-16  694  				drm_rect_height(&plane_state->uapi.dst),
44f5af76b2fd05e Dave Airlie 2020-12-16  695  				fb ? fb->format : NULL,
44f5af76b2fd05e Dave Airlie 2020-12-16 @696  				fb ? fb->modifier : 0,
                                                                        ^^^^^^^^^^^^^^^^^
This code and all previous code assumes that "fb" can be NULL.

44f5af76b2fd05e Dave Airlie 2020-12-16  697  				need_scaler);
44f5af76b2fd05e Dave Airlie 2020-12-16  698  
44f5af76b2fd05e Dave Airlie 2020-12-16  699  	if (ret || plane_state->scaler_id < 0)
                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
Is this an error path?  Should we set "ret = -EINVAL;" for this?

44f5af76b2fd05e Dave Airlie 2020-12-16  700  		return ret;
44f5af76b2fd05e Dave Airlie 2020-12-16  701  
44f5af76b2fd05e Dave Airlie 2020-12-16  702  	/* check colorkey */
44f5af76b2fd05e Dave Airlie 2020-12-16  703  	if (plane_state->ckey.flags) {
44f5af76b2fd05e Dave Airlie 2020-12-16  704  		drm_dbg_kms(&dev_priv->drm,
44f5af76b2fd05e Dave Airlie 2020-12-16  705  			    "[PLANE:%d:%s] scaling with color key not allowed",
44f5af76b2fd05e Dave Airlie 2020-12-16  706  			    intel_plane->base.base.id,
44f5af76b2fd05e Dave Airlie 2020-12-16  707  			    intel_plane->base.name);
44f5af76b2fd05e Dave Airlie 2020-12-16  708  		return -EINVAL;
44f5af76b2fd05e Dave Airlie 2020-12-16  709  	}
44f5af76b2fd05e Dave Airlie 2020-12-16  710  
44f5af76b2fd05e Dave Airlie 2020-12-16  711  	/* Check src format */
44f5af76b2fd05e Dave Airlie 2020-12-16 @712  	switch (fb->format->format) {
                                                        ^^^^^^^^^^
Unchecked dereference.

44f5af76b2fd05e Dave Airlie 2020-12-16  713  	case DRM_FORMAT_RGB565:
44f5af76b2fd05e Dave Airlie 2020-12-16  714  	case DRM_FORMAT_XBGR8888:
44f5af76b2fd05e Dave Airlie 2020-12-16  715  	case DRM_FORMAT_XRGB8888:
44f5af76b2fd05e Dave Airlie 2020-12-16  716  	case DRM_FORMAT_ABGR8888:
44f5af76b2fd05e Dave Airlie 2020-12-16  717  	case DRM_FORMAT_ARGB8888:
44f5af76b2fd05e Dave Airlie 2020-12-16  718  	case DRM_FORMAT_XRGB2101010:

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@xxxxxxxxxxxx
To unsubscribe send an email to kbuild-leave@xxxxxxxxxxxx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux