]> git.baikalelectronics.ru Git - kernel.git/commit
drm/omap: gem: dumb: pitch is an output
authorThierry Reding <treding@nvidia.com>
Mon, 3 Nov 2014 10:57:33 +0000 (11:57 +0100)
committerThierry Reding <treding@nvidia.com>
Thu, 13 Nov 2014 12:27:22 +0000 (13:27 +0100)
commit90e14aa36a370de7d671614999dd59f1a503dde4
tree29b9b2f8ffa842f8c4fe370ba1da2ab2c11e35ff
parent9f9f7a73e75f4005aca8089eac7e20c879bb0ac6
drm/omap: gem: dumb: pitch is an output

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: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/omapdrm/omap_gem.c