• Thierry Reding's avatar
    drm/omap: gem: dumb: pitch is an output · bdb2b933
    Thierry Reding authored
    When creating a dumb buffer object using the DRM_IOCTL_MODE_CREATE_DUMB
    IOCTL, only the width, height, bpp and flags fields are inputs. The
    caller is not guaranteed to zero out or set handle, pitch and size.
    Drivers must not treat these values as possible inputs, otherwise they
    may use uninitialized memory during the computation of the framebuffer
    size.
    
    The OMAP driver uses the pitch field passed in by userspace as a minimum
    and only override it if the driver-computed pitch is larger than what
    userspace provided. To prevent this from causing overallocation, fix the
    minimum pitch to 0 to enforce the driver-computed pitch.
    
    Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>
    Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: default avatarRob Clark <robdclark@gmail.com>
    Acked-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
    Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
    bdb2b933
omap_gem.c 39 KB