svn commit: r235978 - head/sys/kern

Andriy Gapon avg at FreeBSD.org
Fri May 25 07:32:27 UTC 2012


Author: avg
Date: Fri May 25 07:32:26 2012
New Revision: 235978
URL: http://svn.freebsd.org/changeset/base/235978

Log:
  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

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Fri May 25 07:25:30 2012	(r235977)
+++ head/sys/kern/subr_bus.c	Fri May 25 07:32:26 2012	(r235978)
@@ -1810,6 +1810,8 @@ device_add_child_ordered(device_t dev, u
 
 	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)


More information about the svn-src-all mailing list