diff options
| author | Mohsen Zohrevandi <mohsen.zohrevandi@fortanix.com> | 2020-07-01 12:45:11 -0700 |
|---|---|---|
| committer | Mohsen Zohrevandi <mohsen.zohrevandi@fortanix.com> | 2020-07-01 12:45:11 -0700 |
| commit | c457b67af394c37826f75d73cca10319ee96b910 (patch) | |
| tree | 08b66188cae566fabb776611257461a6c681de1b /src/libstd | |
| parent | 3442d23c1a12f1f01a0e07b6bec72b58998f49ef (diff) | |
| download | rust-c457b67af394c37826f75d73cca10319ee96b910.tar.gz rust-c457b67af394c37826f75d73cca10319ee96b910.zip | |
Remove unnecessary check in SGX wait usercall
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sys/sgx/abi/usercalls/mod.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstd/sys/sgx/abi/usercalls/mod.rs b/src/libstd/sys/sgx/abi/usercalls/mod.rs index 69ff7ebf9a1..6ee147d1704 100644 --- a/src/libstd/sys/sgx/abi/usercalls/mod.rs +++ b/src/libstd/sys/sgx/abi/usercalls/mod.rs @@ -161,11 +161,10 @@ pub fn wait(event_mask: u64, mut timeout: u64) -> IoResult<u64> { // model the enclave runner which is serving the wait usercall is not // trusted to ensure accurate timeouts. if let Ok(timeout_signed) = i64::try_from(timeout) { - let tenth = 1 + timeout_signed / 10; + let tenth = timeout_signed / 10; let deviation = (rdrand64() as i64).checked_rem(tenth).unwrap_or(0); timeout = timeout_signed.saturating_add(deviation) as _; } - timeout = cmp::min(u64::MAX - 1, cmp::max(1, timeout)); } unsafe { raw::wait(event_mask, timeout).from_sgx_result() } } |
