[PATCH] testcases: add missing return statements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In some testcases, some non-void functions are missing
a return statement.  This is undetected because:
- no checks are done and so no warnings can be given
- there are some bugs in the linearization of returns
  (the value returned by the last statement is implicitly used).

Fix the testcases by adding the missing return.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/call-variadic.c | 2 +-
 validation/struct-as.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/validation/call-variadic.c b/validation/call-variadic.c
index a438b43a7..8c9815621 100644
--- a/validation/call-variadic.c
+++ b/validation/call-variadic.c
@@ -4,7 +4,7 @@ extern int print(const char *msg, ...);
 
 int foo(const char *fmt, int a, long l, int *p)
 {
-	print("msg %c: %d %d/%ld %ld/%p %p\n", 'x', a, __LINE__, l, 0L, p, NULL);
+	return print("msg %c: %d %d/%ld %ld/%p %p\n", 'x', a, __LINE__, l, 0L, p, NULL);
 }
 
 /*
diff --git a/validation/struct-as.c b/validation/struct-as.c
index f31f7c966..23bca897d 100644
--- a/validation/struct-as.c
+++ b/validation/struct-as.c
@@ -12,7 +12,7 @@ extern int test(int __user *ip);
 
 static int broken(struct hello __user *sp)
 {
-	test(&sp->a);
+	return test(&sp->a);
 }
 /*
  * check-name: Address space of a struct member
-- 
2.15.0

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux