Date: Mon, 13 Feb 2023 17:52:27 GMT From: Mitchell Horne <mhorne@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: afca197f5240 - main - ofwbus: only allow unit number zero Message-ID: <202302131752.31DHqRAB082144@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=afca197f5240ce2c2c7abfe5c9fbc50ba55f178b commit afca197f5240ce2c2c7abfe5c9fbc50ba55f178b Author: Mitchell Horne <mhorne@FreeBSD.org> AuthorDate: 2023-02-13 17:44:03 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> CommitDate: 2023-02-13 17:45:01 +0000 ofwbus: only allow unit number zero ofwbus has always been the root of attachment for OFW/FDT platforms. It may have simplebus children, but we expect only one instance of the ofwbus driver, added directly by nexus. We may as well ensure this remains the case. Reviewed by: jhb MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D38493 --- sys/dev/ofw/ofwbus.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/ofw/ofwbus.c b/sys/dev/ofw/ofwbus.c index cc8c66170cdb..80d013cd06ee 100644 --- a/sys/dev/ofw/ofwbus.c +++ b/sys/dev/ofw/ofwbus.c @@ -89,6 +89,11 @@ ofwbus_probe(device_t dev) if (OF_peer(0) == 0) return (ENXIO); + /* Only one instance of ofwbus. */ + if (device_get_unit(dev) != 0) + panic("ofwbus added with non-zero unit number: %d\n", + device_get_unit(dev)); + device_set_desc(dev, "Open Firmware Device Tree"); return (BUS_PROBE_NOWILDCARD); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302131752.31DHqRAB082144>