diff options
author | avg <avg@FreeBSD.org> | 2012-05-25 07:32:26 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2012-05-25 07:32:26 +0000 |
commit | aa1a7122dcdfa67b3d84beaefc75ab594732927a (patch) | |
tree | cf9ce831177b875eb5e5bfb3a326203a9aab5eb7 | |
parent | cf4496cb429a5d911522e9fcd9554a55a8968775 (diff) | |
download | FreeBSD-src-aa1a7122dcdfa67b3d84beaefc75ab594732927a.zip FreeBSD-src-aa1a7122dcdfa67b3d84beaefc75ab594732927a.tar.gz |
device_add_child: protect against child device with no driver but fixed unit number
This combination doesn't make sense, unit numbers should be hardwired
only in context of a known driver. The wildcard devices should have
wildcard unit numbers.
Reviewed by: jhb
MFC after: 2 weeks
-rw-r--r-- | sys/kern/subr_bus.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index e72ab77..def1652 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1810,6 +1810,8 @@ device_add_child_ordered(device_t dev, u_int order, const char *name, int unit) PDEBUG(("%s at %s with order %u as unit %d", name, DEVICENAME(dev), order, unit)); + KASSERT(name != NULL || unit == -1, + ("child device with wildcard name and specific unit number")); child = make_device(dev, name, unit); if (child == NULL) |