What changed, and why it matters
This commit is a tiny code cleanup in the memory-protection unit (MPU) code for the Trezor hardware wallet. It only adds the word 'const' to a function parameter in four files, meaning the function promises not to modify the input structure. No behavior of the device changes, and there is no security fix or vulnerability here.
No security action needed. Treat as a normal refactoring commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change refactors the signature of mpu_set_active_applet() across the header and three platform implementations (stm32f4, stm32u5, unix) so the applet_layout_t pointer is const-qualified. This is a non-functional API improvement; it does not alter logic, memory permissions, or control flow.
Changed components
core/embed/sys/mpu/inc/sys/mpu.hcore/embed/sys/mpu/stm32f4/mpu.ccore/embed/sys/mpu/stm32u5/mpu.ccore/embed/sys/mpu/unix/mpu.cInspect captured patch +4 / −4
diff --git a/core/embed/sys/mpu/inc/sys/mpu.h b/core/embed/sys/mpu/inc/sys/mpu.h
index bd31a94e5..572b5162c 100644
--- a/core/embed/sys/mpu/inc/sys/mpu.h
+++ b/core/embed/sys/mpu/inc/sys/mpu.h
@@ -93,7 +93,7 @@ typedef struct {
// Sets the MPU to allow unprivileged access to the given applet
// (just one applet at a time can be visible)
-void mpu_set_active_applet(applet_layout_t* layout);
+void mpu_set_active_applet(const applet_layout_t* layout);
// Sets the MPU to allow access to the
// framebuffer at the given address and size.
diff --git a/core/embed/sys/mpu/stm32f4/mpu.c b/core/embed/sys/mpu/stm32f4/mpu.c
index 2f3c3afd4..ee2455b24 100644
--- a/core/embed/sys/mpu/stm32f4/mpu.c
+++ b/core/embed/sys/mpu/stm32f4/mpu.c
@@ -218,7 +218,7 @@ mpu_mode_t mpu_get_mode(void) {
return drv->mode;
}
-void mpu_set_active_applet(applet_layout_t* layout) {
+void mpu_set_active_applet(const applet_layout_t* layout) {
// On STM32F4 one coreapp applet is allowed to run at a time
}
diff --git a/core/embed/sys/mpu/stm32u5/mpu.c b/core/embed/sys/mpu/stm32u5/mpu.c
index 4ed94d148..178c5c4a0 100644
--- a/core/embed/sys/mpu/stm32u5/mpu.c
+++ b/core/embed/sys/mpu/stm32u5/mpu.c
@@ -316,7 +316,7 @@ mpu_mode_t mpu_get_mode(void) {
return drv->mode;
}
-void mpu_set_active_applet(applet_layout_t* layout) {
+void mpu_set_active_applet(const applet_layout_t* layout) {
mpu_driver_t* drv = &g_mpu_driver;
if (!drv->initialized) {
diff --git a/core/embed/sys/mpu/unix/mpu.c b/core/embed/sys/mpu/unix/mpu.c
index 7ee600b11..75257de9f 100644
--- a/core/embed/sys/mpu/unix/mpu.c
+++ b/core/embed/sys/mpu/unix/mpu.c
@@ -29,4 +29,4 @@ mpu_mode_t mpu_reconfig(mpu_mode_t mode) { return MPU_MODE_DISABLED; }
void mpu_restore(mpu_mode_t mode) {}
-void mpu_set_active_applet(applet_layout_t* layout) {}
+void mpu_set_active_applet(const applet_layout_t* layout) {}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.