Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Oct 2008 18:20:45 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r184173 - head/sys/kern
Message-ID:  <200810221820.m9MIKjWe035539@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



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