target/riscv: Add null pointer check before right shift for bscan tunneling.

Change-Id: I5d4764c777f33d48705b3e5273eb840c13cfbfb7
Signed-off-by: eolson <erin.olson@seagate.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7814
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
This commit is contained in:
eolson 2023-06-22 13:02:21 -05:00 committed by Antonio Borneo
parent d57b2448ee
commit 218f6c0181
1 changed files with 4 additions and 2 deletions

View File

@ -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)