Skip to contentSkip to conversation

drm/sysfb: Add custom plane state

bug report Dan Carpenter 1 participant 1 message Oct 17, 2025

lore
Share & tools
lore
#0 lore raw

Hello Thomas Zimmermann,

Commit e45f72b6782f ("drm/sysfb: Add custom plane state") from Sep 18, 2025 (linux-next), leads to the following Smatch static checker warning:

drivers/gpu/drm/sysfb/drm_sysfb_modeset.c:434 drm_sysfb_plane_reset()
error: NULL dereference inside function __drm_gem_reset_shadow_plane()

drivers/gpu/drm/sysfb/drm_sysfb_modeset.c

    424 {
    425         struct drm_sysfb_plane_state *sysfb_plane_state;
    426 
    427         if (plane->state)
    428                 drm_sysfb_plane_state_destroy(to_drm_sysfb_plane_state(plane->state));
    429 
    430         sysfb_plane_state = kzalloc(sizeof(*sysfb_plane_state), GFP_KERNEL);
    431         if (sysfb_plane_state)
    432                 __drm_gem_reset_shadow_plane(plane, &sysfb_plane_state->base);
    433         else
--> 434                 __drm_gem_reset_shadow_plane(plane, NULL);
                                                            ^^^^

Passing a NULL here will crash. (It's the second line where we call drm_format_conv_state_init() that's the problem).

    435 }

regards,
dan carpenter