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)
Sun, Mar 31, 6:05 AM
Unknown Object (File)
Mar 4 2024, 4:49 PM
Unknown Object (File)
Feb 17 2024, 9:36 PM
Unknown Object (File)
Jan 16 2024, 7:33 PM
Unknown Object (File)
Dec 20 2023, 7:07 AM
Unknown Object (File)
Dec 19 2023, 6:26 PM
Unknown Object (File)
Nov 26 2023, 10:51 PM
Unknown Object (File)
Nov 24 2023, 3:23 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.