lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191002221431.GC24151@aptenodytes>
Date:   Wed, 2 Oct 2019 18:14:31 -0400
From:   Paul Kocialkowski <paul.kocialkowski@...tlin.com>
To:     Jernej Skrabec <jernej.skrabec@...l.net>
Cc:     mripard@...nel.org, mchehab@...nel.org, hverkuil-cisco@...all.nl,
        gregkh@...uxfoundation.org, wens@...e.org,
        linux-media@...r.kernel.org, devel@...verdev.osuosl.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/3] media: cedrus: Use helpers to access capture queue

Hi,

On Wed 02 Oct 19, 21:35, Jernej Skrabec wrote:
> Accessing capture queue structue directly is not safe. Use helpers for
> that.

Looks good to me, thanks!

Acked-by: Paul Kocialkowski <paul.kocialkowski@...tlin.com>

Cheers,

Paul

> Signed-off-by: Jernej Skrabec <jernej.skrabec@...l.net>
> ---
>  drivers/staging/media/sunxi/cedrus/cedrus.h      | 8 ++++++--
>  drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 8 ++++++--
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h
> index 986e059e3202..c45fb9a7ad07 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus.h
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus.h
> @@ -197,12 +197,16 @@ static inline dma_addr_t cedrus_buf_addr(struct vb2_buffer *buf,
>  static inline dma_addr_t cedrus_dst_buf_addr(struct cedrus_ctx *ctx,
>  					     int index, unsigned int plane)
>  {
> -	struct vb2_buffer *buf;
> +	struct vb2_buffer *buf = NULL;
> +	struct vb2_queue *vq;
>  
>  	if (index < 0)
>  		return 0;
>  
> -	buf = ctx->fh.m2m_ctx->cap_q_ctx.q.bufs[index];
> +	vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
> +	if (vq)
> +		buf = vb2_get_buffer(vq, index);
> +
>  	return buf ? cedrus_buf_addr(buf, &ctx->dst_fmt, plane) : 0;
>  }
>  
> diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> index 4a0e69855c7f..4650982c69a8 100644
> --- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
> @@ -97,7 +97,7 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
>  	const struct v4l2_ctrl_h264_decode_params *decode = run->h264.decode_params;
>  	const struct v4l2_ctrl_h264_slice_params *slice = run->h264.slice_params;
>  	const struct v4l2_ctrl_h264_sps *sps = run->h264.sps;
> -	struct vb2_queue *cap_q = &ctx->fh.m2m_ctx->cap_q_ctx.q;
> +	struct vb2_queue *cap_q;
>  	struct cedrus_buffer *output_buf;
>  	struct cedrus_dev *dev = ctx->dev;
>  	unsigned long used_dpbs = 0;
> @@ -105,6 +105,8 @@ static void cedrus_write_frame_list(struct cedrus_ctx *ctx,
>  	unsigned int output = 0;
>  	unsigned int i;
>  
> +	cap_q = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
> +
>  	memset(pic_list, 0, sizeof(pic_list));
>  
>  	for (i = 0; i < ARRAY_SIZE(decode->dpb); i++) {
> @@ -168,12 +170,14 @@ static void _cedrus_write_ref_list(struct cedrus_ctx *ctx,
>  				   enum cedrus_h264_sram_off sram)
>  {
>  	const struct v4l2_ctrl_h264_decode_params *decode = run->h264.decode_params;
> -	struct vb2_queue *cap_q = &ctx->fh.m2m_ctx->cap_q_ctx.q;
> +	struct vb2_queue *cap_q;
>  	struct cedrus_dev *dev = ctx->dev;
>  	u8 sram_array[CEDRUS_MAX_REF_IDX];
>  	unsigned int i;
>  	size_t size;
>  
> +	cap_q = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE);
> +
>  	memset(sram_array, 0, sizeof(sram_array));
>  
>  	for (i = 0; i < num_ref; i++) {
> -- 
> 2.23.0
> 

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ