Skip to content

Commit

Permalink
Merge pull request #873 from eosea/bscan_tunnel_seg_fault_fix
Browse files Browse the repository at this point in the history
Add null pointer check before right shift for bscan tunneling.
  • Loading branch information
timsifive authored Jun 29, 2023
2 parents 4be6a56 + 9d23d37 commit 92c0319
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 92c0319

Please sign in to comment.