]> git.baikalelectronics.ru Git - kernel.git/commit
drm/plane: Move range check for format_count earlier
authorSteven Price <steven.price@arm.com>
Fri, 3 Dec 2021 10:28:15 +0000 (10:28 +0000)
committerLiviu Dudau <liviu.dudau@arm.com>
Thu, 28 Apr 2022 15:13:04 +0000 (16:13 +0100)
commit0797eb679da279db2d0d97dbcb632a7a21b7d0ee
tree3203deb276e310be36af01a33102d5e761a337b9
parent2b2072df6a90355e7e0e18a9cc3e8bd8620404df
drm/plane: Move range check for format_count earlier

While the check for format_count > 64 in __drm_universal_plane_init()
shouldn't be hit (it's a WARN_ON), in its current position it will then
leak the plane->format_types array and fail to call
drm_mode_object_unregister() leaking the modeset identifier. Move it to
the start of the function to avoid allocating those resources in the
first place.

Signed-off-by: Steven Price <steven.price@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://lore.kernel.org/dri-devel/20211203102815.38624-1-steven.price@arm.com/
drivers/gpu/drm/drm_plane.c