scan-build reported this:
Logic error Branch condition evaluates to a garbage value tests
/benchmark /test_urcu_hash_rw.c 170
Logic error Branch condition evaluates to a garbage value tests
/benchmark /test_urcu_hash_rw.c 274
It should never happen based on code review, but silence this warning by
initializing to NULL.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
void *test_hash_rw_thr_writer(void *_count)
{
struct lfht_test_node *node;
void *test_hash_rw_thr_writer(void *_count)
{
struct lfht_test_node *node;
- struct cds_lfht_node *ret_node;
struct cds_lfht_iter iter;
struct wr_count *count = _count;
int ret;
struct cds_lfht_iter iter;
struct wr_count *count = _count;
int ret;
+ struct cds_lfht_node *ret_node = NULL;
+
if ((addremove == AR_ADD || add_only)
|| (addremove == AR_RANDOM && rand_r(&URCU_TLS(rand_lookup)) & 1)) {
node = malloc(sizeof(struct lfht_test_node));
if ((addremove == AR_ADD || add_only)
|| (addremove == AR_RANDOM && rand_r(&URCU_TLS(rand_lookup)) & 1)) {
node = malloc(sizeof(struct lfht_test_node));
int test_hash_rw_populate_hash(void)
{
struct lfht_test_node *node;
int test_hash_rw_populate_hash(void)
{
struct lfht_test_node *node;
- struct cds_lfht_node *ret_node;
if (!init_populate)
return 0;
if (!init_populate)
return 0;
}
while (URCU_TLS(nr_add) < init_populate) {
}
while (URCU_TLS(nr_add) < init_populate) {
+ struct cds_lfht_node *ret_node = NULL;
+
node = malloc(sizeof(struct lfht_test_node));
lfht_test_node_init(node,
(void *)(((unsigned long) rand_r(&URCU_TLS(rand_lookup)) % init_pool_size) + init_pool_offset),
node = malloc(sizeof(struct lfht_test_node));
lfht_test_node_init(node,
(void *)(((unsigned long) rand_r(&URCU_TLS(rand_lookup)) % init_pool_size) + init_pool_offset),