Edward O'Callaghan submitted this change.
tests/linux_spi: Validate params file path and flags
Add path and flags validation for '/dev/null' to open operation.
BUG=b:217629892,b:215255210
TEST=`ninja test`.
Signed-off-by: Edward O'Callaghan <quasisec@google.com>
Co-Author: Daniel Campello <campello@chromium.org>
Signed-off-by: Daniel Campello <campello@chromium.org>
Change-Id: If5d24c65f291c53a35509fea5d2f5b3fdb51c306
Reviewed-on: https://review.coreboot.org/c/flashrom/+/62319
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M tests/lifecycle.c
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/tests/lifecycle.c b/tests/lifecycle.c
index 5566b3b..1a8f218 100644
--- a/tests/lifecycle.c
+++ b/tests/lifecycle.c
@@ -355,9 +355,15 @@
* Specifically, it is reading the buffer size from sysfs.
*/
#if CONFIG_LINUX_SPI == 1
+ static struct io_mock_fallback_open_state linux_spi_fallback_open_state = {
+ .noc = 0,
+ .paths = { "/dev/null", NULL },
+ .flags = { O_RDWR },
+ };
const struct io_mock linux_spi_io = {
.fgets = linux_spi_fgets,
.ioctl = linux_spi_ioctl,
+ .fallback_open_state = &linux_spi_fallback_open_state,
};
io_mock_register(&linux_spi_io);
To view, visit change 62319. To unsubscribe, or for help writing mail filters, visit settings.