mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 06:43:09 +00:00
media: coda: cast an operand of multiplication to a larger type
If the width and height are 0xffff (or close), the result of a
multiplication will overflow.
Cast to a larger type to avoid undefined behavior.
Such values are possible in CODA7, but unlikely.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 918c66fd41
("[media] coda: add CODA7541 decoding support")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
a9fef294e8
commit
c2c982def1
@ -585,7 +585,7 @@ static int coda_alloc_context_buffers(struct coda_ctx *ctx,
|
||||
|
||||
if (!ctx->slicebuf.vaddr && q_data->fourcc == V4L2_PIX_FMT_H264) {
|
||||
/* worst case slice size */
|
||||
size = (DIV_ROUND_UP(q_data->rect.width, 16) *
|
||||
size = (unsigned long)(DIV_ROUND_UP(q_data->rect.width, 16) *
|
||||
DIV_ROUND_UP(q_data->rect.height, 16)) * 3200 / 8 + 512;
|
||||
ret = coda_alloc_context_buf(ctx, &ctx->slicebuf, size,
|
||||
"slicebuf");
|
||||
|
Loading…
Reference in New Issue
Block a user