diff mbox series

[ovs-dev] hmap.h: Fix Coverity false positive

Message ID CAGua=s5kSjZfMjtCMDmMHgObcGHjky0xP11_pZDspmeZdK8Y-Q@mail.gmail.com
State Superseded
Headers show
Series [ovs-dev] hmap.h: Fix Coverity false positive | expand

Commit Message

Usman S. Ansari March 19, 2020, 12:32 a.m. UTC
Suggested-by: Ben Pfaff <blp@ovn.org>

Coverity reports a false positive below:
Incorrect expression, Assign_where_compare_meant: use of "="
where "==" may have been intended.
Fixed it by rewriting '(NODE = NULL)' as '((NODE = NULL), false)'.
"make check" passes for this change
Coverity reports 80 errors resolved

Signed-off-by: Usman Ansari <u1422@gmail.com>
---
 include/openvswitch/hmap.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

                           MEMBER))
 #define HMAP_FOR_EACH_IN_BUCKET(NODE, MEMBER, HASH, HMAP)               \

Comments

Ben Pfaff March 19, 2020, 12:36 a.m. UTC | #1
On Wed, Mar 18, 2020 at 05:32:03PM -0700, Usman Ansari wrote:
> Suggested-by: Ben Pfaff <blp@ovn.org>
> 
> Coverity reports a false positive below:
> Incorrect expression, Assign_where_compare_meant: use of "="
> where "==" may have been intended.
> Fixed it by rewriting '(NODE = NULL)' as '((NODE = NULL), false)'.
> "make check" passes for this change
> Coverity reports 80 errors resolved
> 
> Signed-off-by: Usman Ansari <u1422@gmail.com>

Thanks.

This doesn't apply.  "git am" says:

    Applying: hmap.h: Fix Coverity false positive
    error: corrupt patch at line 14
    Patch failed at 0001 hmap.h: Fix Coverity false positive
    hint: Use 'git am --show-current-patch' to see the failed patch
    When you have resolved this problem, run "git am --continue".
    If you prefer to skip this patch, run "git am --skip" instead.
    To restore the original branch and stop patching, run "git am --abort".

Also, all tags go at the bottom of the commit message, that is,
Suggested-by is in the wrong place.  The committer documentation has
some more rules for tags.
William Tu March 19, 2020, 2:36 p.m. UTC | #2
On Wed, Mar 18, 2020 at 5:37 PM Ben Pfaff <blp@ovn.org> wrote:
>
> On Wed, Mar 18, 2020 at 05:32:03PM -0700, Usman Ansari wrote:
> > Suggested-by: Ben Pfaff <blp@ovn.org>
> >
> > Coverity reports a false positive below:
> > Incorrect expression, Assign_where_compare_meant: use of "="
> > where "==" may have been intended.
> > Fixed it by rewriting '(NODE = NULL)' as '((NODE = NULL), false)'.
> > "make check" passes for this change
> > Coverity reports 80 errors resolved
> >
> > Signed-off-by: Usman Ansari <u1422@gmail.com>
>
> Thanks.
>
> This doesn't apply.  "git am" says:
>
>     Applying: hmap.h: Fix Coverity false positive
>     error: corrupt patch at line 14
>     Patch failed at 0001 hmap.h: Fix Coverity false positive
>     hint: Use 'git am --show-current-patch' to see the failed patch
>     When you have resolved this problem, run "git am --continue".
>     If you prefer to skip this patch, run "git am --skip" instead.
>     To restore the original branch and stop patching, run "git am --abort".
>
> Also, all tags go at the bottom of the commit message, that is,
> Suggested-by is in the wrong place.  The committer documentation has
> some more rules for tags.

Hi Usman,

You can also setup travis CI tests for your patch, see
Documentation/topics/testing.rst
And provide a link to the CI test result.

Regards,
William
Usman S. Ansari March 19, 2020, 6:49 p.m. UTC | #3
Resending, I hope it works this time!

On Wed, Mar 18, 2020 at 5:36 PM Ben Pfaff <blp@ovn.org> wrote:

> On Wed, Mar 18, 2020 at 05:32:03PM -0700, Usman Ansari wrote:
> > Suggested-by: Ben Pfaff <blp@ovn.org>
> >
> > Coverity reports a false positive below:
> > Incorrect expression, Assign_where_compare_meant: use of "="
> > where "==" may have been intended.
> > Fixed it by rewriting '(NODE = NULL)' as '((NODE = NULL), false)'.
> > "make check" passes for this change
> > Coverity reports 80 errors resolved
> >
> > Signed-off-by: Usman Ansari <u1422@gmail.com>
>
> Thanks.
>
> This doesn't apply.  "git am" says:
>
>     Applying: hmap.h: Fix Coverity false positive
>     error: corrupt patch at line 14
>     Patch failed at 0001 hmap.h: Fix Coverity false positive
>     hint: Use 'git am --show-current-patch' to see the failed patch
>     When you have resolved this problem, run "git am --continue".
>     If you prefer to skip this patch, run "git am --skip" instead.
>     To restore the original branch and stop patching, run "git am --abort".
>
> Also, all tags go at the bottom of the commit message, that is,
> Suggested-by is in the wrong place.  The committer documentation has
> some more rules for tags.
>
diff mbox series

Patch

diff --git a/include/openvswitch/hmap.h b/include/openvswitch/hmap.h
index 8aea9c2..f48359f 100644
--- a/include/openvswitch/hmap.h
+++ b/include/openvswitch/hmap.h
@@ -136,7 +136,7 @@  struct hmap_node *hmap_random_node(const struct hmap *);
  */
 #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);
\
+         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || ((NODE =
NULL), false); \
          ASSIGN_CONTAINER(NODE, hmap_next_with_hash(&(NODE)->MEMBER),   \