@@ -53,11 +53,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
53
53
54
54
// First, we do some basic argument validation as required by mmap
55
55
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" ) ) ?;
57
57
return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
58
58
}
59
59
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" ) ) ?;
61
61
return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
62
62
}
63
63
@@ -77,7 +77,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
77
77
//
78
78
// Miri doesn't support MAP_FIXED or any any protections other than PROT_READ|PROT_WRITE.
79
79
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" ) ) ?;
81
81
return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
82
82
}
83
83
@@ -96,11 +96,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
96
96
97
97
let align = this. machine . page_align ( ) ;
98
98
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" ) ) ?;
100
100
return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
101
101
} ;
102
102
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" ) ) ?;
104
104
return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
105
105
}
106
106
@@ -131,16 +131,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
131
131
// as a dealloc.
132
132
#[ allow( clippy:: arithmetic_side_effects) ] // PAGE_SIZE is nonzero
133
133
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" ) ) ?;
135
135
return Ok ( Scalar :: from_i32 ( -1 ) ) ;
136
136
}
137
137
138
138
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" ) ) ?;
140
140
return Ok ( Scalar :: from_i32 ( -1 ) ) ;
141
141
} ;
142
142
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" ) ) ?;
144
144
return Ok ( this. eval_libc ( "MAP_FAILED" ) ) ;
145
145
}
146
146
0 commit comments