Skip to content

Commit 6b147db

Browse files
uapi: fixing svc exchange mutable address access (#88)
See rust-lang/rust#114447 for more information about the issue.
2 parents 07654f1 + 3dcc21c commit 6b147db

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

uapi/uapi/svc_exchange.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// SPDX-FileCopyrightText: 2023 Ledger SAS
22
// SPDX-License-Identifier: Apache-2.0
33

4+
use core::ptr::addr_of_mut;
45
use crate::systypes::{EraseMode, EraseType, Status};
56

67
/// SVC Exchange area len. TODO: to be kconfig-generated
@@ -100,7 +101,7 @@ pub extern "C" fn clean_svcexchange(erasetype: EraseType, mode: EraseMode) -> St
100101
_ => return Status::Invalid,
101102
}
102103
unsafe {
103-
core::ptr::write_volatile(&mut SVC_EXCHANGE_AREA as *mut [u8; SVC_EXCH_AREA_LEN], [0; SVC_EXCH_AREA_LEN]);
104+
core::ptr::write_volatile(addr_of_mut!(SVC_EXCHANGE_AREA) as *mut [u8; SVC_EXCH_AREA_LEN], [0; SVC_EXCH_AREA_LEN]);
104105
}
105106
Status::Ok
106107
}

0 commit comments

Comments
 (0)