[bug report] drm/ssd130x: Add support for the SSD132x OLED controller family

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

 



Hello Javier Martinez Canillas,

The patch fdd591e00a9c: "drm/ssd130x: Add support for the SSD132x
OLED controller family" from Oct 14, 2023 (linux-next), leads to the
following Smatch static checker warning:

	drivers/gpu/drm/solomon/ssd130x.c:921 ssd132x_primary_plane_atomic_check()
	error: uninitialized symbol 'crtc_state'.

drivers/gpu/drm/solomon/ssd130x.c
    905 static int ssd132x_primary_plane_atomic_check(struct drm_plane *plane,
    906                                               struct drm_atomic_state *state)
    907 {
    908         struct drm_device *drm = plane->dev;
    909         struct ssd130x_device *ssd130x = drm_to_ssd130x(drm);
    910         struct drm_plane_state *plane_state = drm_atomic_get_new_plane_state(state, plane);
    911         struct ssd130x_plane_state *ssd130x_state = to_ssd130x_plane_state(plane_state);
    912         struct drm_crtc *crtc = plane_state->crtc;
    913         struct drm_crtc_state *crtc_state;
    914         const struct drm_format_info *fi;
    915         unsigned int pitch;
    916         int ret;
    917 
    918         if (crtc)
    919                 crtc_state = drm_atomic_get_new_crtc_state(state, crtc);

crtc_state is not initialized

    920 
--> 921         ret = drm_atomic_helper_check_plane_state(plane_state, crtc_state,

The rule here is that if drm_atomic_helper_check_plane_state() is
inlined then we have to examine it to see if "crtc_state" is used, but
since it's not inlined then passing uninitialized data is a bug
regardless of whether or not it's used.  It will triger a KMsan warning
at runtime as well.

    922                                                   DRM_PLANE_NO_SCALING,
    923                                                   DRM_PLANE_NO_SCALING,
    924                                                   false, false);
    925         if (ret)
    926                 return ret;
    927         else if (!plane_state->visible)
    928                 return 0;
    929 
    930         fi = drm_format_info(DRM_FORMAT_R8);
    931         if (!fi)

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