Commit 25141bc7 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

media: coda: allocate space for mpeg4 decoder mvcol buffer

The MPEG-4 decoder mvcol buffer was registered, but its size not added
to a frame buffer allocation. This could cause the decoder to write past
the end of the allocated buffer for large frame sizes.
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 8e75a536
...@@ -414,8 +414,10 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx, ...@@ -414,8 +414,10 @@ static int coda_alloc_framebuffers(struct coda_ctx *ctx,
size = round_up(ysize, 4096) + ysize / 2; size = round_up(ysize, 4096) + ysize / 2;
else else
size = ysize + ysize / 2; size = ysize + ysize / 2;
if (ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 && /* Add space for mvcol buffers */
dev->devtype->product != CODA_DX6) if (dev->devtype->product != CODA_DX6 &&
(ctx->codec->src_fourcc == V4L2_PIX_FMT_H264 ||
(ctx->codec->src_fourcc == V4L2_PIX_FMT_MPEG4 && i == 0)))
size += ysize / 4; size += ysize / 4;
name = kasprintf(GFP_KERNEL, "fb%d", i); name = kasprintf(GFP_KERNEL, "fb%d", i);
if (!name) { if (!name) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment