Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: verisilicon: AV1: Fix tile info buffer size

Each tile info is composed of: row_sb, col_sb, start_pos
and end_pos (4 bytes each). So the total required memory
is AV1_MAX_TILES * 16 bytes.
Use the correct #define to allocate the buffer and avoid
writing tile info in non-allocated memory.

Signed-off-by: Benjamin Gaignard <benjamin.gaignard@collabora.com>
Fixes: 727a400686a2c ("media: verisilicon: Add Rockchip AV1 decoder")
Cc: stable@vger.kernel.org
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Benjamin Gaignard and committed by
Hans Verkuil
a505ca2d 355a1100

+2 -2
+2 -2
drivers/media/platform/verisilicon/rockchip_vpu981_hw_av1_dec.c
··· 381 381 return -ENOMEM; 382 382 av1_dec->global_model.size = GLOBAL_MODEL_SIZE; 383 383 384 - av1_dec->tile_info.cpu = dma_alloc_coherent(vpu->dev, AV1_MAX_TILES, 384 + av1_dec->tile_info.cpu = dma_alloc_coherent(vpu->dev, AV1_TILE_INFO_SIZE, 385 385 &av1_dec->tile_info.dma, 386 386 GFP_KERNEL); 387 387 if (!av1_dec->tile_info.cpu) 388 388 return -ENOMEM; 389 - av1_dec->tile_info.size = AV1_MAX_TILES; 389 + av1_dec->tile_info.size = AV1_TILE_INFO_SIZE; 390 390 391 391 av1_dec->film_grain.cpu = dma_alloc_coherent(vpu->dev, 392 392 ALIGN(sizeof(struct rockchip_av1_film_grain), 2048),