Skip to content

Commit

Permalink
use explicit casting
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry committed Jul 20, 2022
1 parent fc3278b commit 1482da6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions programs/bpf_loader/src/syscalls/cpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ fn check_instruction_size(
.feature_set
.is_active(&feature_set::loosen_cpi_size_restriction::ID)
{
let data_len = u64::try_from(data_len).unwrap();
let data_len = data_len as u64;
let max_data_len = MAX_CPI_INSTRUCTION_DATA_LEN;
if data_len > max_data_len {
return Err(SyscallError::MaxInstructionDataLenExceeded {
Expand All @@ -762,8 +762,8 @@ fn check_instruction_size(
.into());
}

let num_accounts = u64::try_from(num_accounts).unwrap();
let max_accounts = u64::from(MAX_CPI_INSTRUCTION_ACCOUNTS);
let num_accounts = num_accounts as u64;
let max_accounts = MAX_CPI_INSTRUCTION_ACCOUNTS as u64;
if num_accounts > max_accounts {
return Err(SyscallError::MaxInstructionAccountsExceeded {
num_accounts,
Expand Down

0 comments on commit 1482da6

Please sign in to comment.