Skip to content

Commit 4c0a33c

Browse files
committed
[ot] hw/opentitan: ot_lc_ctrl: Fix HW_CFG load memcpy size calculation
These `memcpy`s were accidentally using the size of the dereferenced byte array (i.e., always just 1 byte), and so were only copying the first byte of the HW_CFG device ID and manufacturing state that were being loaded from the OTP. Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
1 parent 7b28086 commit 4c0a33c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hw/opentitan/ot_lc_ctrl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,9 +1212,9 @@ static void ot_lc_ctrl_load_otp_hw_cfg(OtLcCtrlState *s)
12121212
const OtOTPHWCfg *hw_cfg = oc->get_hw_cfg(s->otp_ctrl);
12131213

12141214
memcpy(&s->regs[R_DEVICE_ID_0], &hw_cfg->device_id[0],
1215-
sizeof(*hw_cfg->device_id));
1215+
sizeof(hw_cfg->device_id));
12161216
memcpy(&s->regs[R_MANUF_STATE_0], &hw_cfg->manuf_state[0],
1217-
sizeof(*hw_cfg->manuf_state));
1217+
sizeof(hw_cfg->manuf_state));
12181218

12191219
if (!s->socdbg) {
12201220
return;

0 commit comments

Comments
 (0)