diff mbox series

alarm02: fix for 32-bit kernels

Message ID fb2cefb44d91e346c7947a76c3131913008b0db0.1536664816.git.jstancek@redhat.com
State Accepted
Headers show
Series alarm02: fix for 32-bit kernels | expand

Commit Message

Jan Stancek Sept. 11, 2018, 11:21 a.m. UTC
Test fails on 32-bit kernels with:
  alarm02.c:55: FAIL: alarm(4294967295) returned 2147483647 as unexpected

because kernel alarm_setitimer() limits seconds to INT_MAX to avoid
negative timeval settings which would cause immediate expiry:

  static unsigned int alarm_setitimer(unsigned int seconds)
  {
        struct itimerval it_new, it_old;

  #if BITS_PER_LONG < 64
        if (seconds > INT_MAX)
                seconds = INT_MAX;
  #endif

Don't test UINT_MAX.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
 testcases/kernel/syscalls/alarm/alarm02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cyril Hrubis Sept. 11, 2018, noon UTC | #1
Hi!
Looks good, acked.
Jan Stancek Sept. 11, 2018, 1:59 p.m. UTC | #2
----- Original Message -----
> Hi!
> Looks good, acked.

Pushed.

Regards,
Jan
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/alarm/alarm02.c b/testcases/kernel/syscalls/alarm/alarm02.c
index d318c8b14637..94239060c4ef 100644
--- a/testcases/kernel/syscalls/alarm/alarm02.c
+++ b/testcases/kernel/syscalls/alarm/alarm02.c
@@ -21,7 +21,7 @@  static struct tcase {
 	char *str;
 	unsigned int sec;
 } tcases[] = {
-	{"UINT_MAX", UINT_MAX},
+	{"INT_MAX", INT_MAX},
 	{"UINT_MAX/2", UINT_MAX/2},
 	{"UINT_MAX/4", UINT_MAX/4},
 };