diff options
author | Tomas Vanek <vanekt@fbl.cz> | 2019-12-20 23:56:08 +0100 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2020-03-07 15:30:05 +0000 |
commit | a2e822834df52efef5e1bbcb91a6eb1afbf102db (patch) | |
tree | 0e5caf3d1daa7dfeb6cabc7f3163d6dd5bbc73f9 /src/target/ls1_sap.c | |
parent | 4e981bc27c36e696dc8ace3ab4bab534564770c1 (diff) | |
download | riscv-openocd-a2e822834df52efef5e1bbcb91a6eb1afbf102db.zip riscv-openocd-a2e822834df52efef5e1bbcb91a6eb1afbf102db.tar.gz riscv-openocd-a2e822834df52efef5e1bbcb91a6eb1afbf102db.tar.bz2 |
helper/binarybuffer: fix clang static analyzer warnings
Writing bits to an uninitialized buffer generated false warnings.
Zero buffers before setting them by buf_set_u32|64()
(do it only if bit-by-bit copy loop is used,
zeroed buffer is not necessary if a fast path write is used)
Change-Id: I2f7f8ddb45b0cbd08d3e249534fc51f4b5cc6694
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5383
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Diffstat (limited to 'src/target/ls1_sap.c')
-rw-r--r-- | src/target/ls1_sap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/target/ls1_sap.c b/src/target/ls1_sap.c index bc46ed4..330042f 100644 --- a/src/target/ls1_sap.c +++ b/src/target/ls1_sap.c @@ -113,7 +113,7 @@ static void ls1_sap_set_instr(struct jtag_tap *tap, uint32_t new_instr) static void ls1_sap_set_addr_high(struct jtag_tap *tap, uint16_t addr_high) { struct scan_field field; - uint8_t buf[2]; + uint8_t buf[2] = { 0 }; ls1_sap_set_instr(tap, 0x21); @@ -130,7 +130,7 @@ static void ls1_sap_memory_cmd(struct jtag_tap *tap, uint32_t address, int32_t size, bool rnw) { struct scan_field field; - uint8_t cmd[8]; + uint8_t cmd[8] = { 0 }; ls1_sap_set_instr(tap, 0x24); |