media: mediatek: vcodec: return EINVAL if plane is too small
authorJustin Green <greenjustin@chromium.org>
Wed, 15 Jun 2022 15:38:27 +0000 (16:38 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Mon, 27 Jun 2022 08:11:12 +0000 (09:11 +0100)
commitf5caaa47f55fa742f1a230e5b4258c139e223c74
treec23382fdeb28e50eb31b23a0a82078cfa10216d9
parentd4de27a9b1eadd33a2e40de87a646d1bf5fef756
media: mediatek: vcodec: return EINVAL if plane is too small

Modify vb2ops_vdec_buf_prepare to return EINVAL if the size of the plane
is less than the size of the image. Currently we just log an error and
return 0 anyway, which may cause a buffer overrun bug.

Signed-off-by: Justin Green <greenjustin@chromium.org>
Suggested-by: Andres Calderon Jaramillo <andrescj@chromium.org>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c