[bug report] drm: Use the state pointer directly in planes atomic_check

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

 



Hello Maxime Ripard,

This is a semi-automatic email about new static checker warnings.

The patch dec92020671c: "drm: Use the state pointer directly in 
planes atomic_check" from Feb 19, 2021, leads to the following Smatch 
complaint:

    drivers/gpu/drm/armada/armada_plane.c:97 armada_drm_plane_atomic_check()
    warn: variable dereferenced before check 'state' (see line 84)

drivers/gpu/drm/armada/armada_plane.c
    81  int armada_drm_plane_atomic_check(struct drm_plane *plane,
    82          struct drm_atomic_state *state)
    83  {
    84          struct drm_plane_state *new_plane_state = drm_atomic_get_new_plane_state(state,
                                                                                         ^^^^^
state is deferenced here.

    85                                                                                   plane);
    86          struct armada_plane_state *st = to_armada_plane_state(new_plane_state);
    87          struct drm_crtc *crtc = new_plane_state->crtc;
    88          struct drm_crtc_state *crtc_state;
    89          bool interlace;
    90          int ret;
    91  
    92          if (!new_plane_state->fb || WARN_ON(!new_plane_state->crtc)) {
    93                  new_plane_state->visible = false;
    94                  return 0;
    95          }
    96  
    97          if (state)

This used to check "if (new_plane_state->state)".  If state is NULL then
we will already have crashed.

    98                  crtc_state = drm_atomic_get_existing_crtc_state(state,
    99                                                                  crtc);
   100          else
   101                  crtc_state = crtc->state;
   102  
   103          ret = drm_atomic_helper_check_plane_state(new_plane_state, crtc_state,
   104                                                    0,
   105                                                    INT_MAX, true, false);

regards,
dan carpenter



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux