drivers/bitbang: silence scan-build warning 13/7013/2
authorAntonio Borneo <borneo.antonio@gmail.com>
Wed, 1 Jun 2022 17:47:48 +0000 (19:47 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 10 Jun 2022 21:54:40 +0000 (21:54 +0000)
The array is partially initialized with buf_set_u32(,5,32,), then
the rest of the array is read from SWD.
But scan-build report the array to have garbage content after the
initialization, due to the offset of 5 bit that only inits part of
the first byte.

Silence the false positive from scan-build by initializing the
array.

Change-Id: Ic38d50280f67939e3ec5fa05741f66d5f993f8c2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7013
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/jtag/drivers/bitbang.c

index 898d6d3df9c5d482d167348d8f6b8a8e45416023..78dcb2947d415e0e08f2f9df91ce5f67ffa978a4 100644 (file)
@@ -532,8 +532,9 @@ static void bitbang_swd_write_reg(uint8_t cmd, uint32_t value, uint32_t ap_delay
        /* Devices do not reply to DP_TARGETSEL write cmd, ignore received ack */
        bool check_ack = swd_cmd_returns_ack(cmd);
 
+       /* init the array to silence scan-build */
+       uint8_t trn_ack_data_parity_trn[DIV_ROUND_UP(4 + 3 + 32 + 1 + 4, 8)] = {0};
        for (;;) {
-               uint8_t trn_ack_data_parity_trn[DIV_ROUND_UP(4 + 3 + 32 + 1 + 4, 8)];
                buf_set_u32(trn_ack_data_parity_trn, 1 + 3 + 1, 32, value);
                buf_set_u32(trn_ack_data_parity_trn, 1 + 3 + 1 + 32, 1, parity_u32(value));
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)