[LTP] [PATCH 2/2] ima_boot_aggregate: TBROK on fread() failure
Petr Vorel
pvorel@suse.cz
Fri Nov 1 15:37:26 CET 2024
fread() should read 1 byte, quit when it fails it.
This fixes warning: ignoring return value of ‘fread’ declared with
attribute ‘warn_unused_result’ [-Wunused-result].
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
.../kernel/security/integrity/ima/src/ima_boot_aggregate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
index 68d12fc3c2..420b0c736d 100644
--- a/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
+++ b/testcases/kernel/security/integrity/ima/src/ima_boot_aggregate.c
@@ -116,7 +116,8 @@ static void do_test(void)
break;
}
#endif
- fread(event.data, event.header.len, 1, fp);
+ if (fread(event.data, event.header.len, 1, fp) != 1)
+ tst_brk(TBROK, "failed to read 1 byte");
}
SAFE_FCLOSE(fp);
--
2.45.2
More information about the ltp
mailing list