Question about possible NULL Pointer Dereference in hx83102_get_modes()

Zichen Xie zichenxie0106 at gmail.com
Wed Oct 9 19:38:22 UTC 2024


Dear Developers for DRM PANEL DRIVERS,

We are developing a static analyzer for Linux Kernel, and we are
curious about the function drm_mode_duplicate() in
hx83102_get_modes().
https://elixir.bootlin.com/linux/v6.12-rc2/source/drivers/gpu/drm/panel/panel-himax-hx83102.c#L567

```

struct drm_display_mode *mode;

mode = drm_mode_duplicate(connector->dev, m);

mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;

```

drm_mode_duplicate() will return NULL if it fails to allocate memory,
so NULL check is necessary for this function.
Directly accessing 'mode->type' may lead to NULL Pointer Dereference.

Please kindly correct us if we missed any key information. Looking
forward to your response!
We can help provide a patch if it's a true bug.

Best regards,
Zichen


More information about the dri-devel mailing list