diff --git a/src/libc/pthread/thread.rs b/src/libc/pthread/thread.rs index 648d6b00a..1a9ee3a51 100644 --- a/src/libc/pthread/thread.rs +++ b/src/libc/pthread/thread.rs @@ -110,7 +110,7 @@ pub fn pthread_attr_setstacksize( attr: MutPtr, stacksize: GuestUSize, ) -> i32 { - if attr.is_null() || stacksize < PTHREAD_STACK_MIN || stacksize.is_multiple_of(PAGE_SIZE) { + if attr.is_null() || stacksize < PTHREAD_STACK_MIN || !stacksize.is_multiple_of(PAGE_SIZE) { return EINVAL; } check_magic!(env, attr, MAGIC_ATTR); diff --git a/src/mem/allocator.rs b/src/mem/allocator.rs index 66304219d..cfb97469e 100644 --- a/src/mem/allocator.rs +++ b/src/mem/allocator.rs @@ -334,7 +334,7 @@ impl Allocator { } fn align(size: GuestUSize, align: GuestUSize) -> GuestUSize { - if size.is_multiple_of(align) { + if !size.is_multiple_of(align) { size + align - (size % align) } else { size