Page MenuHomeFreeBSD

Fix logic error in gvinum's gv_set_sd_state()
ClosedPublic

Authored by dim on Jan 8 2017, 4:18 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Sep 1, 6:09 PM
Unknown Object (File)
Sat, Aug 29, 9:10 PM
Unknown Object (File)
Sat, Aug 29, 2:42 PM
Unknown Object (File)
Fri, Aug 28, 10:51 AM
Unknown Object (File)
Thu, Aug 27, 5:16 PM
Unknown Object (File)
Thu, Aug 27, 3:43 PM
Unknown Object (File)
Wed, Aug 26, 11:33 AM
Unknown Object (File)
Mon, Aug 24, 12:43 AM
Subscribers

Details

Summary

With clang 4.0.0, I'm getting the following warnings:

sys/geom/vinum/geom_vinum_state.c:186:7: error: logical not is only applied to the left hand side of this bitwise operator [-Werror,-Wlogical-not-parentheses]
                if (!flags & GV_SETSTATE_FORCE)
                    ^      ~
sys/geom/vinum/geom_vinum_state.c:186:7: note: add parentheses after the '!' to evaluate the bitwise operator first
                if (!flags & GV_SETSTATE_FORCE)
                    ^
                     (                        )
sys/geom/vinum/geom_vinum_state.c:186:7: note: add parentheses around left hand side expression to silence this warning
                if (!flags & GV_SETSTATE_FORCE)
                    ^
                    (     )

The logical not operator should obiously be called after masking.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dim retitled this revision from to Fix logic error in gvinum's gv_set_sd_state().
dim updated this object.
dim edited the test plan for this revision. (Show Details)
dim added reviewers: hselasky, gjb, pfg, mav.
mav edited edge metadata.

I doubt anybody knows this code enough, but it seems logical.

This revision is now accepted and ready to land.Jan 8 2017, 4:25 PM
pfg edited edge metadata.

Nice catch, Coverity missed it completely.

This revision was automatically updated to reflect the committed changes.

I know too little of this code to comment.