[bug report] drm/vmwgfx: Add and connect plane helper functions
Dan Carpenter
dan.carpenter at oracle.com
Thu Dec 14 08:01:42 UTC 2017
Hello Sinclair Yeh,
This is a semi-automatic email about new static checker warnings.
The patch 060e2ad57041: "drm/vmwgfx: Add and connect plane helper
functions" from Mar 23, 2017, leads to the following Smatch complaint:
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c:466 vmw_du_primary_plane_atomic_check()
error: we previously assumed 'crtc' could be null (see line 463)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
441 int vmw_du_primary_plane_atomic_check(struct drm_plane *plane,
442 struct drm_plane_state *state)
443 {
444 struct drm_crtc_state *crtc_state = NULL;
445 struct drm_framebuffer *new_fb = state->fb;
446 struct drm_rect clip = {};
447 int ret;
448
449 if (state->crtc)
^^^^^^^^^^^
Check for NULL
450 crtc_state = drm_atomic_get_new_crtc_state(state->state, state->crtc);
451
452 if (crtc_state && crtc_state->enable) {
453 clip.x2 = crtc_state->adjusted_mode.hdisplay;
454 clip.y2 = crtc_state->adjusted_mode.vdisplay;
455 }
456
457 ret = drm_atomic_helper_check_plane_state(state, crtc_state, &clip,
458 DRM_PLANE_HELPER_NO_SCALING,
459 DRM_PLANE_HELPER_NO_SCALING,
460 false, true);
461
462 if (!ret && new_fb) {
463 struct drm_crtc *crtc = state->crtc;
464 struct vmw_connector_state *vcs;
465 struct vmw_display_unit *du = vmw_crtc_to_du(crtc);
466 struct vmw_private *dev_priv = vmw_priv(crtc->dev);
^^^^^^^^^
Unchecked dereference
467 struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(new_fb);
468
regards,
dan carpenter
More information about the dri-devel
mailing list