[libcamera-devel] [PATCH] pipeline: rkisp1: Add check for non-existent frame info

Kieran Bingham kieran.bingham at ideasonboard.com
Mon Apr 12 22:03:43 CEST 2021


Hi Sebastian,

On 11/04/2021 17:48, Sebastian Fricke wrote:
> Add a check, that makes sure that the given FrameBuffer is associated
> to a RkISP1FrameInfo instance. The current code tries to access the
> frame info without checking if it actually exists.
> 
> Fixes: 0eb65e14e libcamera: pipeline: rkisp1: Attach to an IPA
> 
> Signed-off-by: Sebastian Fricke <sebastian.fricke at posteo.net>
> ---
>  src/libcamera/pipeline/rkisp1/rkisp1.cpp | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> index 03757327..eca7d608 100644
> --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp
> @@ -1079,6 +1079,8 @@ void PipelineHandlerRkISP1::paramReady(FrameBuffer *buffer)
>  	RkISP1CameraData *data = cameraData(activeCamera_);
>  
>  	RkISP1FrameInfo *info = data->frameInfo_.find(buffer);
> +	if (!info)
> +		return;

If the frameInfo can't find what it's looking for, then that should be a
fatal error (if it's not already) ... but even if it's Fatal, I think
it's best to make sure the return paths on FATAL's are handled as we may
choose to cause FATAL to not assert in non-debug builds.

Along with that, other code paths do check this and return accordingly,
so this improves consistency.


So

Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>

>  
>  	info->paramDequeued = true;
>  	tryCompleteRequest(info->request);
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list