aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_bus.c
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2012-05-25 07:32:26 +0000
committerAndriy Gapon <avg@FreeBSD.org>2012-05-25 07:32:26 +0000
commitfa44da0995a91fa7820a29d8e3a91ee18baf882a (patch)
treecf9ce831177b875eb5e5bfb3a326203a9aab5eb7 /sys/kern/subr_bus.c
parent255f31647e55ef7bb531a37a79eaee45d1e5b9c5 (diff)
downloadsrc-fa44da0995a91fa7820a29d8e3a91ee18baf882a.tar.gz
src-fa44da0995a91fa7820a29d8e3a91ee18baf882a.zip
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
Notes
Notes: svn path=/head/; revision=235978
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r--sys/kern/subr_bus.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index e72ab771cff1..def16526f38f 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)