Fix affinity array size incorrect issue
This commit is contained in:
parent
7deeccb03b
commit
7122529b6b
@ -10,7 +10,7 @@ pub fn do_sched_yield() -> Result<isize> {
|
|||||||
pub fn do_sched_getaffinity(pid: pid_t, buf_size: size_t, buf_ptr: *mut u8) -> Result<isize> {
|
pub fn do_sched_getaffinity(pid: pid_t, buf_size: size_t, buf_ptr: *mut u8) -> Result<isize> {
|
||||||
// Construct safe Rust types
|
// Construct safe Rust types
|
||||||
let buf_size = {
|
let buf_size = {
|
||||||
if buf_size * 8 < AVAIL_CPUSET.cpu_count() {
|
if buf_size < CpuSet::len() {
|
||||||
return_errno!(EINVAL, "buf size is not big enough");
|
return_errno!(EINVAL, "buf size is not big enough");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ pub fn do_sched_getaffinity(pid: pid_t, buf_size: size_t, buf_ptr: *mut u8) -> R
|
|||||||
pub fn do_sched_setaffinity(pid: pid_t, buf_size: size_t, buf_ptr: *const u8) -> Result<isize> {
|
pub fn do_sched_setaffinity(pid: pid_t, buf_size: size_t, buf_ptr: *const u8) -> Result<isize> {
|
||||||
// Convert unsafe C types into safe Rust types
|
// Convert unsafe C types into safe Rust types
|
||||||
let buf_size = {
|
let buf_size = {
|
||||||
if buf_size * 8 < AVAIL_CPUSET.cpu_count() {
|
if buf_size < CpuSet::len() {
|
||||||
return_errno!(EINVAL, "buf size is not big enough");
|
return_errno!(EINVAL, "buf size is not big enough");
|
||||||
}
|
}
|
||||||
CpuSet::len()
|
CpuSet::len()
|
||||||
|
Loading…
Reference in New Issue
Block a user