[libcamera-devel] [PATCH 11/11] ipa: vimc: Validate configuration file in init()
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Apr 27 05:17:13 CEST 2020
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>
---
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
More information about the libcamera-devel
mailing list