Skip to content

Commit f17b111

Browse files
ajaykishnashif
authored andcommitted
tests: kernel: init: Fix integer overflow issue
Cast the msec to nsec conversion macro with u64_t to fix the integer overflow issue. Fixes #9135 Signed-off-by: Ajay Kishore <[email protected]>
1 parent c1f54cc commit f17b111

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/kernel/init/src/main.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include <ztest.h>
88

9+
#define NSEC_PER_MSEC (u64_t)(NSEC_PER_USEC * USEC_PER_MSEC)
910
/**
1011
* @brief Test delay during boot
1112
* @defgroup kernel_bootdelay_tests Init
@@ -23,8 +24,8 @@ void verify_bootdelay(void)
2324

2425
/* compare this with the boot delay specified */
2526
zassert_true(SYS_CLOCK_HW_CYCLES_TO_NS64(current_cycles) >=
26-
(CONFIG_BOOT_DELAY * NSEC_PER_USEC * USEC_PER_MSEC),
27-
"boot delay not executed");
27+
(NSEC_PER_MSEC * CONFIG_BOOT_DELAY),
28+
"boot delay not executed");
2829
}
2930

3031
/**

0 commit comments

Comments
 (0)