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
F132339584: D9093.id.diff
Thu, Oct 16, 1:22 AM
Unknown Object (File)
Sun, Oct 12, 7:39 AM
Unknown Object (File)
Sat, Oct 4, 6:55 AM
Unknown Object (File)
Sat, Oct 4, 1:27 AM
Unknown Object (File)
Fri, Sep 26, 10:55 PM
Unknown Object (File)
Sep 15 2025, 1:46 AM
Unknown Object (File)
Sep 4 2025, 10:15 AM
Unknown Object (File)
Sep 4 2025, 9:13 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.