]> git.baikalelectronics.ru Git - kernel.git/commit
drm: simpledrm: fix a potential NULL dereference
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 15 May 2021 09:53:15 +0000 (12:53 +0300)
committerThomas Zimmermann <tzimmermann@suse.de>
Sat, 15 May 2021 12:04:42 +0000 (14:04 +0200)
commitbb550ac9a0ee71a1f33173087d9001e0a523ba73
treeb1b607abff30f241a74b5f5f2e83f279dbde6b44
parentfe8cfb52e2e98dfa163c04bc0b1fe4d1c14ffc52
drm: simpledrm: fix a potential NULL dereference

The drm_format_info() function returns NULL if the format is
unsupported, but the simplefb_get_validated_format() is expected to
return error pointers.  If we propagate the NULL return then it will
lead to a NULL dereference in the callers.  Swap the NULL and trade it
in for an ERR_PTR(-EINVAL).

Fixes: b7390008b818 ("drm: Add simpledrm driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/YJ+aC47XX58ICXax@mwanda
drivers/gpu/drm/tiny/simpledrm.c