[ovs-dev] Coverity incorrect expression of HMAP_FOR_EACH_WITH_HASH

William Tu u9012063 at gmail.com
Wed Mar 18 00:00:42 UTC 2020


Hi,

We're looking at the coverity results and there are lots of issues of
Incorrect expression
Assign_where_compare_meant: use of "=" where "==" may have been intended

Because in our source code, we have
HMAP_FOR_EACH_WITH_HASH(id_node, node, hash, &pool->map) {
...

And Due to "(NODE = NULL)" in the CONDITION statement below:
#define HMAP_FOR_EACH_WITH_HASH(NODE, MEMBER, HASH, HMAP)               \
    for (INIT_CONTAINER(NODE, hmap_first_with_hash(HMAP, HASH), MEMBER); \
         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \
         ASSIGN_CONTAINER(NODE, hmap_next_with_hash(&(NODE)->MEMBER),   \
                          MEMBER))

While this is correct, I wonder how can we avoid this?
Thanks
William


More information about the dev mailing list