Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jan 2012 07:09:18 +0000 (UTC)
From:      Eitan Adler <eadler@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r230125 - head/sys/kern
Message-ID:  <201201150709.q0F79Iif067938@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler (ports committer)
Date: Sun Jan 15 07:09:18 2012
New Revision: 230125
URL: http://svn.freebsd.org/changeset/base/230125

Log:
  - Fix undefined behavior when device_get_name is null
  - Make error message more informative
  
  PR:		kern/149800
  Submitted by:	olgeni
  Approved by:	cperciva
  MFC after:	1 week

Modified:
  head/sys/kern/subr_bus.c

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Sun Jan 15 00:46:29 2012	(r230124)
+++ head/sys/kern/subr_bus.c	Sun Jan 15 07:09:18 2012	(r230125)
@@ -2020,9 +2020,15 @@ device_probe_child(device_t dev, device_
 			if (!hasclass) {
 				if (device_set_devclass(child,
 				    dl->driver->name) != 0) {
+					char const * devname =
+					    device_get_name(child);
+					if (devname == NULL)
+						devname = "(unknown)";
 					printf("driver bug: Unable to set "
-					    "devclass (devname: %s)\n",
-					    device_get_name(child));
+					    "devclass (class: %s "
+					    "devname: %s)\n",
+					    dl->driver->name,
+					    devname);
 					(void)device_set_driver(child, NULL);
 					continue;
 				}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201150709.q0F79Iif067938>