Skip to content

Commit

Permalink
xtensa: userspace: fix uninitialized return values in mpu_map_region_add
Browse files Browse the repository at this point in the history
Ensure that *first_idx is populated for the case of adding entries
to an empty table

Signed-off-by: Anthony Giardina <anthony.giardina@intel.com>
  • Loading branch information
agiardin committed May 2, 2024
1 parent ea995f6 commit f9ba5e1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/xtensa/core/mpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ static int mpu_map_region_add(struct xtensa_mpu_map *map,

xtensa_mpu_entry_set(entry_slot_s, start_addr, true,
access_rights, memory_type);
*first_idx = XTENSA_MPU_NUM_ENTRIES - 1;
} else {
/*
* Populate the last two entries to indicate
Expand All @@ -459,6 +460,7 @@ static int mpu_map_region_add(struct xtensa_mpu_map *map,
xtensa_mpu_entry_set(entry_slot_e, end_addr, false,
XTENSA_MPU_ACCESS_P_NA_U_NA,
CONFIG_XTENSA_MPU_DEFAULT_MEM_TYPE);
*first_idx = XTENSA_MPU_NUM_ENTRIES - 2;
}

ret = 0;
Expand Down

0 comments on commit f9ba5e1

Please sign in to comment.