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)
Sep 30 2024, 9:31 AM
Unknown Object (File)
Sep 27 2024, 12:06 AM
Unknown Object (File)
Sep 22 2024, 5:18 PM
Unknown Object (File)
Sep 22 2024, 2:54 AM
Unknown Object (File)
Sep 17 2024, 3:24 PM
Unknown Object (File)
Sep 17 2024, 8:15 AM
Unknown Object (File)
Sep 16 2024, 8:56 PM
Unknown Object (File)
Sep 15 2024, 5:54 PM
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.