Skip to contentSkip to conversation

alarm02: fix for 32-bit kernels

PATCH New Jan Stancek 2 participants 3 messages Sep 11, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 alarm02: fix for 32-bit kernels

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.

---
 testcases/kernel/syscalls/alarm/alarm02.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/kernel/syscalls/alarm/alarm02.c +1 -1
index d318c8b14637..94239060c4ef 100644
@@ -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},
 };
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 1/1 alarm02: fix for 32-bit kernels

----- Original Message -----

Quoted 2 lines

Hi!
Looks good, acked.

Pushed.

Regards,
Jan