Page MenuHomeFreeBSD

cam: Fix wiring fence post error
ClosedPublic

Authored by imp on Jan 12 2022, 9:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 16, 1:54 AM
Unknown Object (File)
Wed, May 15, 2:17 AM
Unknown Object (File)
Wed, May 8, 4:45 PM
Unknown Object (File)
Fri, May 3, 11:49 PM
Unknown Object (File)
Fri, May 3, 9:27 AM
Unknown Object (File)
Fri, May 3, 5:44 AM
Unknown Object (File)
Apr 19 2024, 9:09 AM
Unknown Object (File)
Mar 31 2024, 6:05 AM
Subscribers

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
Lint Not Applicable
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.