[libcamera-devel] [PATCH 11/11] ipa: vimc: Validate configuration file in init()

Jacopo Mondi jacopo at jmondi.org
Mon Apr 27 11:17:12 CEST 2020


Hi Laurent,

On Mon, Apr 27, 2020 at 06:17:13AM +0300, Laurent Pinchart wrote:
> Make sure we can open the configuration file passed to the init()
> function, and return an error otherwise.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>

Thanks
  j

> ---
>  src/ipa/vimc/vimc.cpp | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp
> index e6bda8ec58b0..f29bc504d8c8 100644
> --- a/src/ipa/vimc/vimc.cpp
> +++ b/src/ipa/vimc/vimc.cpp
> @@ -19,6 +19,7 @@
>
>  #include <libipa/ipa_interface_wrapper.h>
>
> +#include "file.h"
>  #include "log.h"
>
>  namespace libcamera {
> @@ -65,7 +66,15 @@ int IPAVimc::init(const IPASettings &settings)
>  {
>  	trace(IPAOperationInit);
>
> -	LOG(IPAVimc, Debug) << "initializing vimc IPA!";
> +	LOG(IPAVimc, Debug)
> +		<< "initializing vimc IPA with configuration file "
> +		<< settings.configurationFile;
> +
> +	File conf(settings.configurationFile);
> +	if (!conf.open(File::ReadOnly)) {
> +		LOG(IPAVimc, Error) << "Failed to open configuration file";
> +		return -EINVAL;
> +	}
>
>  	return 0;
>  }
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel


More information about the libcamera-devel mailing list