@@ -53,11 +53,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
5353
5454 // First, we do some basic argument validation as required by mmap
5555 if ( flags & ( map_private | map_shared) ) . count_ones ( ) != 1 {
56- this. set_last_error ( Scalar :: from_i32 ( this. eval_libc_i32 ( "EINVAL" ) ) ) ?;
56+ this. set_last_error ( this. eval_libc ( "EINVAL" ) ) ?;
5757 return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
5858 }
5959 if length == 0 {
60- this. set_last_error ( Scalar :: from_i32 ( this. eval_libc_i32 ( "EINVAL" ) ) ) ?;
60+ this. set_last_error ( this. eval_libc ( "EINVAL" ) ) ?;
6161 return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
6262 }
6363
@@ -77,7 +77,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
7777 //
7878 // Miri doesn't support MAP_FIXED or any any protections other than PROT_READ|PROT_WRITE.
7979 if flags & map_fixed != 0 || prot != prot_read | prot_write {
80- this. set_last_error ( Scalar :: from_i32 ( this. eval_libc_i32 ( "ENOTSUP" ) ) ) ?;
80+ this. set_last_error ( this. eval_libc ( "ENOTSUP" ) ) ?;
8181 return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
8282 }
8383
@@ -96,11 +96,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
9696
9797 let align = this. machine . page_align ( ) ;
9898 let Some ( map_length) = length. checked_next_multiple_of ( this. machine . page_size ) else {
99- this. set_last_error ( Scalar :: from_i32 ( this. eval_libc_i32 ( "EINVAL" ) ) ) ?;
99+ this. set_last_error ( this. eval_libc ( "EINVAL" ) ) ?;
100100 return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
101101 } ;
102102 if map_length > this. target_usize_max ( ) {
103- this. set_last_error ( Scalar :: from_i32 ( this. eval_libc_i32 ( "EINVAL" ) ) ) ?;
103+ this. set_last_error ( this. eval_libc ( "EINVAL" ) ) ?;
104104 return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
105105 }
106106
@@ -131,16 +131,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
131131 // as a dealloc.
132132 #[ allow( clippy:: arithmetic_side_effects) ] // PAGE_SIZE is nonzero
133133 if addr. addr ( ) . bytes ( ) % this. machine . page_size != 0 {
134- this. set_last_error ( Scalar :: from_i32 ( this. eval_libc_i32 ( "EINVAL" ) ) ) ?;
134+ this. set_last_error ( this. eval_libc ( "EINVAL" ) ) ?;
135135 return Ok ( Scalar :: from_i32 ( -1 ) ) ;
136136 }
137137
138138 let Some ( length) = length. checked_next_multiple_of ( this. machine . page_size ) else {
139- this. set_last_error ( Scalar :: from_i32 ( this. eval_libc_i32 ( "EINVAL" ) ) ) ?;
139+ this. set_last_error ( this. eval_libc ( "EINVAL" ) ) ?;
140140 return Ok ( Scalar :: from_i32 ( -1 ) ) ;
141141 } ;
142142 if length > this. target_usize_max ( ) {
143- this. set_last_error ( Scalar :: from_i32 ( this. eval_libc_i32 ( "EINVAL" ) ) ) ?;
143+ this. set_last_error ( this. eval_libc ( "EINVAL" ) ) ?;
144144 return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
145145 }
146146
0 commit comments