[PATCH RFC 2/7] selftests/nolibc: use unsigned indices for testcases

From: Thomas Weißschuh
Date: Tue Jul 18 2023 - 18:05:50 EST


They should never be negative.

Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
tools/testing/selftests/nolibc/nolibc-test.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 698af242d3e4..1bd99e0fab4d 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -62,7 +62,7 @@ static const char *argv0;
/* definition of a series of tests */
struct test {
const char *name; /* test name */
- int (*func)(int min, int max); /* handler */
+ int (*func)(unsigned int min, unsigned int max); /* handler */
};

#ifndef _NOLIBC_STDLIB_H
@@ -570,7 +570,7 @@ static int expect_strne(const char *expr, int llen, const char *cmp)
#define CASE_TEST(name) \
case __LINE__: llen += printf("%d %s", test, #name);

-int run_startup(int min, int max)
+int run_startup(unsigned int min, unsigned int max)
{
int test;
int ret = 0;
@@ -773,7 +773,7 @@ int test_mmap_munmap(void)
/* Run syscall tests between IDs <min> and <max>.
* Return 0 on success, non-zero on failure.
*/
-int run_syscall(int min, int max)
+int run_syscall(unsigned int min, unsigned int max)
{
struct timeval tv;
struct timezone tz;
@@ -884,7 +884,7 @@ int run_syscall(int min, int max)
return ret;
}

-int run_stdlib(int min, int max)
+int run_stdlib(unsigned int min, unsigned int max)
{
int test;
int tmp;
@@ -1027,7 +1027,7 @@ static int expect_vfprintf(int llen, size_t c, const char *expected, const char
return ret;
}

-static int run_vfprintf(int min, int max)
+static int run_vfprintf(unsigned int min, unsigned int max)
{
int test;
int tmp;
@@ -1070,7 +1070,7 @@ static int smash_stack(void)
return 1;
}

-static int run_protection(int min, int max)
+static int run_protection(unsigned int min, unsigned int max)
{
pid_t pid;
int llen = 0, status;

--
2.41.0