From 8a9be175a76d34ed9fcf4c4f0233ef73736b8eab Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 27 Apr 2020 05:09:58 +0300 Subject: ipa: vimc: Validate configuration file in init() Make sure we can open the configuration file passed to the init() function, and return an error otherwise. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi Reviewed-by: Kieran Bingham --- src/ipa/vimc/vimc.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/ipa/vimc/vimc.cpp b/src/ipa/vimc/vimc.cpp index e6bda8ec..f29bc504 100644 --- a/src/ipa/vimc/vimc.cpp +++ b/src/ipa/vimc/vimc.cpp @@ -19,6 +19,7 @@ #include +#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; } -- cgit v1.2.1