Re: [PATCH 1/2] media: v4l: vsp1: Fix bru null pointer access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Biju,

On 01/03/2021 12:08, Biju Das wrote:
> RZ/G2L SoC has only BRS. This patch fixes null pointer access,when only
> BRS is enabled.
> 
> Fixes: cbb7fa49c7466("media: v4l: vsp1: Rename BRU to BRx")
> Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx>
> ---
>  drivers/media/platform/vsp1/vsp1_drm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/media/platform/vsp1/vsp1_drm.c b/drivers/media/platform/vsp1/vsp1_drm.c
> index 86d5e3f4b1ff..f6d2f47a4058 100644
> --- a/drivers/media/platform/vsp1/vsp1_drm.c
> +++ b/drivers/media/platform/vsp1/vsp1_drm.c
> @@ -245,7 +245,7 @@ static int vsp1_du_pipeline_setup_brx(struct vsp1_device *vsp1,
>  		brx = &vsp1->bru->entity;
>  	else if (pipe->brx && !drm_pipe->force_brx_release)
>  		brx = pipe->brx;
> -	else if (!vsp1->bru->entity.pipe)
> +	else if (vsp1_feature(vsp1, VSP1_HAS_BRU) && !vsp1->bru->entity.pipe)
>  		brx = &vsp1->bru->entity;
>  	else
>  		brx = &vsp1->brs->entity;


The comments here describe that the choice to start at the BRU is
arbitrary, so if we could confirm that there will always be a BRS
otherwise, we could swap those to save an extra feature check.

But as we have both vsp1_feature(vsp1, VSP1_HAS_BRU) and
vsp1_feature(vsp1, VSP1_HAS_BRS), I don't think that's the case.

I'd almost want to check for vsp1_feature(vsp1, VSP1_HAS_BRS) on the
brs->entity line to keep the symmetry ... but it wouldn't be needed, as
it should fall through. If there isn't a BRS there must be a BRU or we
wouldn't be setting up a brx in the first place ;-)

So I think what you have is good.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@xxxxxxxxxxxxxxxx>



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux