media: mediatek: vcodec: fix h264 cavlc bitstream fail
authorYunfei Dong <yunfei.dong@mediatek.com>
Tue, 18 Oct 2022 11:41:22 +0000 (19:41 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:04 +0000 (13:32 +0100)
commitad8eb8ed0d39e18628ec6e2ec45fc2f791f72852
tree6be8a9b52d54eedc2f66c253a93fb834176eca74
parent246f266634f546bb0cc7f5f09631dd5d03b3318e
media: mediatek: vcodec: fix h264 cavlc bitstream fail

[ Upstream commit d555409dd1b7cc9e7e5b9e2924c0ef4bf23f6c9b ]

Some cavlc bistream will decode fail when the frame size is less than
20 bytes. Need to add pending data at the end of the bitstream.

For the minimum size of mapped memory is 256 bytes(16x16), adding four
bytes data won't lead to access unknown virtual memory.

Fixes: 59fba9eed5a7 ("media: mediatek: vcodec: support stateless H.264 decoding for mt8192")
Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c