Page MenuHomeFreeBSD

cam: Fix wiring fence post error
ClosedPublic

Authored by imp on Jan 12 2022, 9:46 PM.

Details

Reviewers
jhb
Group Reviewers
cam
Commits
rG272e4f538467: cam: Fix wiring fence post error
Summary

If the last matching device entry partially matched in camperiphunit,
but then hit a continue case, we'd mistakenly think we had a match on
that entry. This lead to a number of problems downstream (usually a
belief that we had a duplicate wiring hint because unit = 0 is the
default). Fix this by branching to the bottom of the loop to set wired
to false rather than relying on 'continue' to set that as a side effect.

Sponsored by: Netflix

Diff Detail

Repository
rG FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

imp requested review of this revision.Jan 12 2022, 9:46 PM
sys/cam/cam_periph.c
558

and here's where we mistakenly think we have a duplicate

649

This is the use of the 'wired' that is incorrect as a result of this bug...

jhb added a subscriber: jhb.
jhb added inline comments.
sys/cam/cam_periph.c
613–616

You could perhaps keep using continue if you wanted by making this a for-loop instead:

for (wired = false; resource_find_dev(...) == 0; wired = false) {
This revision is now accepted and ready to land.Jan 12 2022, 9:57 PM

I like John's suggestion

This revision now requires review to proceed.Jan 13 2022, 5:09 AM
This revision was not accepted when it landed; it landed in state Needs Review.Jan 13 2022, 10:24 PM
This revision was automatically updated to reflect the committed changes.