We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a5b967c commit 710bf7dCopy full SHA for 710bf7d
rust/kernel/error.rs
@@ -256,7 +256,10 @@ pub(crate) fn from_kernel_err_ptr<T>(ptr: *mut T) -> Result<*mut T> {
256
// which always fits in an `i16`, as per the invariant above.
257
// And an `i16` always fits in an `i32`. So casting `err` to
258
// an `i32` can never overflow, and is always valid.
259
- return Err(Error::from_kernel_errno(err as i32));
+ //
260
+ // INVARIANT: `rust_helper_is_err()` ensures `err` is a
261
+ // negative value greater-or-equal to `-bindings::MAX_ERRNO`
262
+ return Err(unsafe { Error::from_kernel_errno_unchecked(err as i32) });
263
}
264
Ok(ptr)
265
0 commit comments