diff options
author | Yasushi SHOJI <yashi@spacecubics.com> | 2021-11-29 22:33:27 +0900 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-12-11 17:41:46 +0000 |
commit | d7142a57271079eca8e1c15034b74499ff4e3ef5 (patch) | |
tree | aafe0cb618fd4ae92648628b94d8ff471da08552 /src | |
parent | 2753c9868e28467e700799a8584b589af9e88600 (diff) | |
download | riscv-openocd-d7142a57271079eca8e1c15034b74499ff4e3ef5.zip riscv-openocd-d7142a57271079eca8e1c15034b74499ff4e3ef5.tar.gz riscv-openocd-d7142a57271079eca8e1c15034b74499ff4e3ef5.tar.bz2 |
target/target: Check checksum_memory before call
Make sure checksum_memory is present. Otherwise it'll segfault.
Change-Id: If31123323bd8a03282da43505c9604fde735ad0e
Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6758
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/target/target.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/target/target.c b/src/target/target.c index 27888a8..e9cbe39 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2530,6 +2530,10 @@ int target_checksum_memory(struct target *target, target_addr_t address, uint32_ LOG_ERROR("Target not examined yet"); return ERROR_FAIL; } + if (!target->type->checksum_memory) { + LOG_ERROR("Target %s doesn't support checksum_memory", target_name(target)); + return ERROR_FAIL; + } retval = target->type->checksum_memory(target, address, size, &checksum); if (retval != ERROR_OK) { |