diff options
author | Andriy Gapon <avg@FreeBSD.org> | 2012-05-25 07:32:26 +0000 |
---|---|---|
committer | Andriy Gapon <avg@FreeBSD.org> | 2012-05-25 07:32:26 +0000 |
commit | fa44da0995a91fa7820a29d8e3a91ee18baf882a (patch) | |
tree | cf9ce831177b875eb5e5bfb3a326203a9aab5eb7 /sys/kern/subr_bus.c | |
parent | 255f31647e55ef7bb531a37a79eaee45d1e5b9c5 (diff) | |
download | src-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.c | 2 |
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) |