Skip to content

Commit c457b67

Browse files
committed
Remove unnecessary check in SGX wait usercall
1 parent 3442d23 commit c457b67

File tree

1 file changed

+1
-2
lines changed
  • src/libstd/sys/sgx/abi/usercalls

1 file changed

+1
-2
lines changed

src/libstd/sys/sgx/abi/usercalls/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,10 @@ pub fn wait(event_mask: u64, mut timeout: u64) -> IoResult<u64> {
161161
// model the enclave runner which is serving the wait usercall is not
162162
// trusted to ensure accurate timeouts.
163163
if let Ok(timeout_signed) = i64::try_from(timeout) {
164-
let tenth = 1 + timeout_signed / 10;
164+
let tenth = timeout_signed / 10;
165165
let deviation = (rdrand64() as i64).checked_rem(tenth).unwrap_or(0);
166166
timeout = timeout_signed.saturating_add(deviation) as _;
167167
}
168-
timeout = cmp::min(u64::MAX - 1, cmp::max(1, timeout));
169168
}
170169
unsafe { raw::wait(event_mask, timeout).from_sgx_result() }
171170
}

0 commit comments

Comments
 (0)