Skip to content
Snippets Groups Projects
Commit 1093321d authored by Nicolas Dufresne's avatar Nicolas Dufresne
Browse files

media: cedrus: Fix NULL buf dereference


This is a regression introduced after porting to vb2_find_buffer.
The function returnis NULL when the buffer isn't found. The HEVC
decoder would call a helper to get the motion vector buffer address
by passing the index. This is fixed by passing the buffer
pointer instead of the index.

Fixes: 7f361451 ("cedrus: Use vb2_find_buffer")
Signed-off-by: default avatarNicolas Dufresne <nicolas.dufresne@collabora.com>
parent 12082952
No related branches found
No related tags found
No related merge requests found
......@@ -91,16 +91,13 @@ static void cedrus_h265_sram_write_data(struct cedrus_dev *dev, void *data,
static inline dma_addr_t
cedrus_h265_frame_info_mv_col_buf_addr(struct cedrus_ctx *ctx,
unsigned int index,
struct vb2_buffer *buf,
const struct v4l2_ctrl_hevc_sps *sps)
{
struct cedrus_buffer *cedrus_buf = NULL;
struct vb2_buffer *buf = NULL;
struct vb2_queue *vq;
vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
if (vq)
buf = vb2_get_buffer(vq, index);
if (buf)
cedrus_buf = vb2_to_cedrus_buffer(buf);
......@@ -148,8 +145,8 @@ static void cedrus_h265_frame_info_write_single(struct cedrus_ctx *ctx,
dma_addr_t dst_luma_addr = cedrus_dst_buf_addr(ctx, buf, 0);
dma_addr_t dst_chroma_addr = cedrus_dst_buf_addr(ctx, buf, 1);
dma_addr_t mv_col_buf_addr[2] = {
cedrus_h265_frame_info_mv_col_buf_addr(ctx, buf->index, sps),
cedrus_h265_frame_info_mv_col_buf_addr(ctx, buf->index, sps)
cedrus_h265_frame_info_mv_col_buf_addr(ctx, buf, sps),
cedrus_h265_frame_info_mv_col_buf_addr(ctx, buf, sps)
};
u32 offset = VE_DEC_H265_SRAM_OFFSET_FRAME_INFO +
VE_DEC_H265_SRAM_OFFSET_FRAME_INFO_UNIT * index;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment