Page MenuHomeFreeBSD

cam: Fix wiring fence post error
ClosedPublic

Authored by imp on Jan 12 2022, 9:46 PM.
Tags
None
Referenced Files
F132333408: D33873.id101395.diff
Wed, Oct 15, 11:59 PM
F132333407: D33873.id.diff
Wed, Oct 15, 11:59 PM
F132333406: D33873.id101430.diff
Wed, Oct 15, 11:59 PM
F132333403: D33873.id101390.diff
Wed, Oct 15, 11:59 PM
Unknown Object (File)
Wed, Oct 15, 1:28 PM
Unknown Object (File)
Fri, Oct 3, 12:59 PM
Unknown Object (File)
Mon, Sep 22, 12:00 AM
Unknown Object (File)
Sun, Sep 21, 5:43 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.