This is an automated email from Gerrit. Tomas Vanek ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/5383
-- gerrit commit 04e92b9baf715c89d0847322785699a8dbd70754 Author: Tomas Vanek <[email protected]> Date: Fri Dec 20 23:56:08 2019 +0100 helper/binarybuffer: fix clang static analyzer warnings Writing bits to an uninitialized buffer generated false warnings. Use conditional code compiled just for static analyzer to zero buffer before writing. Change-Id: I2f7f8ddb45b0cbd08d3e249534fc51f4b5cc6694 Signed-off-by: Tomas Vanek <[email protected]> diff --git a/src/helper/binarybuffer.h b/src/helper/binarybuffer.h index 7ac221e..21c930a 100644 --- a/src/helper/binarybuffer.h +++ b/src/helper/binarybuffer.h @@ -49,6 +49,10 @@ static inline void buf_set_u32(uint8_t *_buffer, buffer[0] = (value >> 0) & 0xff; } else { for (unsigned i = first; i < first + num; i++) { +#ifdef __clang_analyzer__ + if (i % 8 == 0) + buffer[i / 8] = 0; +#endif if (((value >> (i - first)) & 1) == 1) buffer[i / 8] |= 1 << (i % 8); else @@ -87,6 +91,10 @@ static inline void buf_set_u64(uint8_t *_buffer, buffer[0] = (value >> 0) & 0xff; } else { for (unsigned i = first; i < first + num; i++) { +#ifdef __clang_analyzer__ + if (i % 8 == 0) + buffer[i / 8] = 0; +#endif if (((value >> (i - first)) & 1) == 1) buffer[i / 8] |= 1 << (i % 8); else -- _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
