diff mbox series

[v3,5/5] fanotify: Add a pedantic check for return value

Message ID 20201113164944.26101-6-pvorel@suse.cz
State Changes Requested
Headers show
Series Introduce SAFE_FANOTIFY_MARK() macro + cleanup | expand

Commit Message

Petr Vorel Nov. 13, 2020, 4:49 p.m. UTC
for fanotify_init() in safe_fanotify_init()

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/syscalls/fanotify/fanotify.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Cyril Hrubis Nov. 19, 2020, 10:31 a.m. UTC | #1
Hi!
This one looks obviously okay.
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
index 04b6699cf..dc76d092b 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify.h
+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
@@ -193,6 +193,11 @@  int safe_fanotify_init(const char *file, const int lineno,
 		tst_brk(TBROK | TERRNO, "%s:%d: fanotify_init() failed",
 			file, lineno);
 	}
+
+	if (rval < -1) {
+		tst_brk(TBROK | TERRNO, "%s:%d: invalid fanotify_init() return %d",
+			file, lineno, rval);
+	}
 #else
 	tst_brk(TCONF, "Header <sys/fanotify.h> is not present");
 #endif /* HAVE_SYS_FANOTIFY_H */