Skip to content

Commit

Permalink
avoid fallback logic (and we do not need the flag value currently any…
Browse files Browse the repository at this point in the history
…way)
  • Loading branch information
RalfJung committed Nov 19, 2020
1 parent cdb7adb commit 517728b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/shims/posix/linux/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,9 @@ fn getrandom<'tcx>(

// The only supported flags are GRND_RANDOM and GRND_NONBLOCK,
// neither of which have any effect on our current PRNG.
let flags = this.read_scalar(flags)?;
// Either `i32` or `isize` is fine.
if flags.to_machine_isize(this).is_err() {
flags.to_i32()?;
}
let _flags = this.read_scalar(flags)?;
// FIXME: Check that this is an integer type of the right size.
// Currently, some callers pass i32 and some usize, is that even allowed?

this.gen_random(ptr, len)?;
this.write_scalar(Scalar::from_machine_usize(len, this), dest)?;
Expand Down

0 comments on commit 517728b

Please sign in to comment.