From fbd55120f3c58dc7d16b3870a8f36f07277bb338 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 29 Oct 2023 21:27:49 +0900 Subject: [PATCH] Cast up before multiplication --- thread_pthread_mn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thread_pthread_mn.c b/thread_pthread_mn.c index 8dadb269de..aa69515f32 100644 --- a/thread_pthread_mn.c +++ b/thread_pthread_mn.c @@ -174,8 +174,8 @@ nt_therad_stack_size(void) rb_vm_t *vm = GET_VM(); int sz = (int)(vm->default_params.thread_vm_stack_size + vm->default_params.thread_machine_stack_size + MSTACK_PAGE_SIZE); - int page_num = (sz + MSTACK_PAGE_SIZE - 1) / MSTACK_PAGE_SIZE; - msz = page_num * MSTACK_PAGE_SIZE; + int page_num = roomof(sz, MSTACK_PAGE_SIZE); + msz = (size_t)page_num * MSTACK_PAGE_SIZE; return msz; }