diff mbox series

[2/2] ima_boot_aggregate: TBROK on fread() failure

Message ID 20241101143726.1278291-2-pvorel@suse.cz (mailing list archive)
State New
Headers show
Series [1/2] ima_boot_aggregate: Fix openssl 3.0 deprecation warnings | expand

Commit Message

Petr Vorel Nov. 1, 2024, 2:37 p.m. UTC
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(-)

Comments

Petr Vorel Nov. 14, 2024, 9:48 p.m. UTC | #1
Hi all,

both patches merged.

Kind regards,
Petr
diff mbox series

Patch

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);