fix for sanitizer errors in left shifts 05/5005/4
authorMete Balci <metebalci@gmail.com>
Sat, 30 Mar 2019 11:51:03 +0000 (12:51 +0100)
committerTomas Vanek <vanekt@fbl.cz>
Wed, 10 Apr 2019 15:37:51 +0000 (16:37 +0100)
The modified lines cause "runtime error: left shift of <X> by <Y>
places cannot be represented in type 'int'", because integer
literal is cast to int by default.

Change-Id: Ie38119b5eb46ee470e0d149959e523b48ac4d66d
Signed-off-by: Mete Balci <metebalci@gmail.com>
Reviewed-on: http://openocd.zylin.com/5005
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
src/helper/binarybuffer.h
src/jtag/core.c
src/target/armv8.c

index f1da8c4aa3cb070aa1c7140e6061a035fe82921e..7ac221e47b345e84c3dd2673097bc4a5b561a729 100644 (file)
@@ -118,7 +118,7 @@ static inline uint32_t buf_get_u32(const uint8_t *_buffer,
                uint32_t result = 0;
                for (unsigned i = first; i < first + num; i++) {
                        if (((buffer[i / 8] >> (i % 8)) & 1) == 1)
-                               result |= 1 << (i - first);
+                               result |= 1U << (i - first);
                }
                return result;
        }
index f90ae99baa3c7f3bc9477dec351c0e7b9410c2a9..e57f62db7df1012979e05e51d06b318adaf0096b 100644 (file)
@@ -1007,7 +1007,7 @@ static bool jtag_examine_chain_match_tap(const struct jtag_tap *tap)
                return true;
 
        /* optionally ignore the JTAG version field - bits 28-31 of IDCODE */
-       uint32_t mask = tap->ignore_version ? ~(0xf << 28) : ~0;
+       uint32_t mask = tap->ignore_version ? ~(0xfU << 28) : ~0U;
        uint32_t idcode = tap->idcode & mask;
 
        /* Loop over the expected identification codes and test for a match */
index c8cfcae2050bcb3d38edfd69b5a4a0481eb5d9a2..e271c1a9242c973fc2ae022740a3d13798aae39c 100644 (file)
@@ -646,7 +646,7 @@ int armv8_read_mpidr(struct armv8_common *armv8)
        retval = dpm->instr_read_data_r0(dpm, armv8_opcode(armv8, READ_REG_MPIDR), &mpidr);
        if (retval != ERROR_OK)
                goto done;
-       if (mpidr & 1<<31) {
+       if (mpidr & 1U<<31) {
                armv8->multi_processor_system = (mpidr >> 30) & 1;
                armv8->cluster_id = (mpidr >> 8) & 0xf;
                armv8->cpu_id = mpidr & 0x3;

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)