Skip to content

Commit

Permalink
target/riscv: Add null pointer check before right shift for bscan tun…
Browse files Browse the repository at this point in the history
…neling.

Change-Id: I5d4764c777f33d48705b3e5273eb840c13cfbfb7
Signed-off-by: eolson <[email protected]>
Reviewed-on: https://review.openocd.org/c/openocd/+/7814
Reviewed-by: Antonio Borneo <[email protected]>
Tested-by: jenkins
Reviewed-by: Jan Matyas <[email protected]>
  • Loading branch information
eosea authored and borneoa committed Jul 22, 2023
1 parent d57b244 commit 218f6c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/target/riscv/batch.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,10 @@ int riscv_batch_run(struct riscv_batch *batch)

if (bscan_tunnel_ir_width != 0) {
/* need to right-shift "in" by one bit, because of clock skew between BSCAN TAP and DM TAP */
for (size_t i = 0; i < batch->used_scans; ++i)
buffer_shr((batch->fields + i)->in_value, DMI_SCAN_BUF_SIZE, 1);
for (size_t i = 0; i < batch->used_scans; ++i) {
if ((batch->fields + i)->in_value)
buffer_shr((batch->fields + i)->in_value, DMI_SCAN_BUF_SIZE, 1);
}
}

for (size_t i = 0; i < batch->used_scans; ++i)
Expand Down

0 comments on commit 218f6c0

Please sign in to comment.