]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: venus: venc: Fix potential null pointer dereference on pointer fmt
authorColin Ian King <colin.king@canonical.com>
Fri, 9 Jul 2021 12:30:25 +0000 (14:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Sep 2021 08:00:43 +0000 (10:00 +0200)
commitbe54585b7d38003ba4bedc263de92e17794217e3
treeb157602abd35156cc18d315caf833847b4771f40
parent5dd91bb65f199d98d7f4c84ea8921207c07e2402
media: venus: venc: Fix potential null pointer dereference on pointer fmt

[ Upstream commit 09ea9719a423fc675d40dd05407165e161ea0c48 ]

Currently the call to find_format can potentially return a NULL to
fmt and the nullpointer is later dereferenced on the assignment of
pixmp->num_planes = fmt->num_planes.  Fix this by adding a NULL pointer
check and returning NULL for the failure case.

Addresses-Coverity: ("Dereference null return")

Fixes: aaaa93eda64b ("[media] media: venus: venc: add video encoder files")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/qcom/venus/venc.c