svn commit: r184173 - head/sys/kern

Marcel Moolenaar marcel at FreeBSD.org
Wed Oct 22 18:20:45 UTC 2008


Author: marcel
Date: Wed Oct 22 18:20:45 2008
New Revision: 184173
URL: http://svn.freebsd.org/changeset/base/184173

Log:
  Trivially avoid a null pointer dereference when drivers
  don't set the rman description. While drivers should set
  it, a kernel panic is not the right behaviour when faced
  without one.

Modified:
  head/sys/kern/subr_rman.c

Modified: head/sys/kern/subr_rman.c
==============================================================================
--- head/sys/kern/subr_rman.c	Wed Oct 22 18:07:37 2008	(r184172)
+++ head/sys/kern/subr_rman.c	Wed Oct 22 18:20:45 2008	(r184173)
@@ -866,7 +866,8 @@ sysctl_rman(SYSCTL_HANDLER_ARGS)
 	if (res_idx == -1) {
 		bzero(&urm, sizeof(urm));
 		urm.rm_handle = (uintptr_t)rm;
-		strlcpy(urm.rm_descr, rm->rm_descr, RM_TEXTLEN);
+		if (rm->rm_descr != NULL)
+			strlcpy(urm.rm_descr, rm->rm_descr, RM_TEXTLEN);
 		urm.rm_start = rm->rm_start;
 		urm.rm_size = rm->rm_end - rm->rm_start + 1;
 		urm.rm_type = rm->rm_type;


More information about the svn-src-all mailing list