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)
Sat, Apr 18, 10:29 AM
Unknown Object (File)
Wed, Apr 15, 12:17 AM
Unknown Object (File)
Tue, Apr 14, 10:17 PM
Unknown Object (File)
Tue, Apr 14, 8:07 AM
Unknown Object (File)
Sat, Apr 11, 7:18 PM
Unknown Object (File)
Sat, Apr 11, 2:04 PM
Unknown Object (File)
Sat, Apr 11, 2:30 AM
Unknown Object (File)
Mon, Apr 6, 5:08 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.