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>
This commit is contained in:
@@ -402,7 +402,7 @@ static uint32_t dtmcontrol_scan(struct target *target, uint32_t out)
|
||||
{
|
||||
struct scan_field field;
|
||||
uint8_t in_value[4];
|
||||
uint8_t out_value[4];
|
||||
uint8_t out_value[4] = { 0 };
|
||||
|
||||
buf_set_u32(out_value, 0, 32, out);
|
||||
|
||||
@@ -468,6 +468,7 @@ static dmi_status_t dmi_scan(struct target *target, uint32_t *address_in,
|
||||
}
|
||||
|
||||
memset(in, 0, num_bytes);
|
||||
memset(out, 0, num_bytes);
|
||||
|
||||
assert(info->abits != 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user