drm/atomic: fix out of bounds read in for_each_*_in_state helpers
authorAndrey Ryabinin <a.ryabinin@samsung.com>
Mon, 25 May 2015 10:29:44 +0000 (13:29 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 26 May 2015 15:31:52 +0000 (17:31 +0200)
commit60f207a5b6d8f23c2e8388b415e8d5c7311cc79d
tree222c8cbf96f442329c2dc37ae7a986bc5e7e4c12
parent955f3c334f0fb2b843efad5cc6d3b7e141e9d666
drm/atomic: fix out of bounds read in for_each_*_in_state helpers

for_each_*_in_state validate array index after
access to array elements, thus perform out of bounds read.

Fix this by validating index in the first place and read
array element iff validation was successful.

Fixes: df63b9994eaf ("drm/atomic: Add for_each_{connector,crtc,plane}_in_state helper macros")
Signed-off-by: Andrey Ryabinin <a.ryabinin@samsung.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
include/drm/drm_atomic.h