diff mbox series

[v4,6/6] fanotify: Add a pedantic check for return value

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

Commit Message

Petr Vorel Nov. 26, 2020, 9:41 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(+)
diff mbox series

Patch

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