[PATCH] drm/atomic: fix null dereference

Sudip Mukherjee sudipm.mukherjee at gmail.com
Sat Jul 11 23:14:38 PDT 2015


On Sat, Jul 11, 2015 at 02:17:49PM -0400, Rob Clark wrote:
> On Sat, Jul 11, 2015 at 1:24 PM, Sudip Mukherjee
> <sudipm.mukherjee at gmail.com> wrote:
> > We are checking the size of e->event but we were doing it when e is
> > known to be NULL.
> 
> nak, this will leak event_space..  since it is a sizeof, it isn't
> actually deref'ing e, but rather just using the static type info, so
> it's ok (although perhaps funny looking)
Agreed, and I just verified the same with an userspace code also.
But i think this will confuse people like me who have started to look
at the drm code to start working with some new drm driver.
what about:
file_priv->event_space += sizeof(struct drm_event_vblank);

It will server the same purpose yet it will not be confusing.

regards
sudip


More information about the dri-devel mailing list