Skip to content

Commit 4649a71

Browse files
committed
remove unnecessary unsafe
1 parent 3325f1c commit 4649a71

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drv/auxflash-server/src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,7 @@ impl ServerImpl {
252252
let mut read_addr = active_slot_base as usize;
253253
// Note: this cannot overflow as spare slot was checked above.
254254
let mut write_addr = spare_slot as usize * SLOT_SIZE;
255-
// SAFETY: this cannot overflow as data_size is less or equal to
256-
// SLOT_SIZE and active_slot is valid for reads up to SLOT_SIZE.
257-
let read_end = unsafe { read_addr.unchecked_add(data_size) };
255+
let read_end = read_addr + data_size;
258256
while read_addr < read_end {
259257
let amount = (read_end - read_addr).min(buf.len());
260258

0 commit comments

Comments
 (0)