diff options
author | marcel <marcel@FreeBSD.org> | 2008-10-22 18:20:45 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2008-10-22 18:20:45 +0000 |
commit | 7de1858d0cf8286c7b0eedbaa95bc65b0e1681da (patch) | |
tree | 46e0a1d39563343e7e8c155ae9fcfd4cb2287485 | |
parent | 1b96342d9e21d7b1f4ac22a0c873f7aff8507b80 (diff) | |
download | FreeBSD-src-7de1858d0cf8286c7b0eedbaa95bc65b0e1681da.zip FreeBSD-src-7de1858d0cf8286c7b0eedbaa95bc65b0e1681da.tar.gz |
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.
-rw-r--r-- | sys/kern/subr_rman.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/subr_rman.c b/sys/kern/subr_rman.c index ae350ed..ac1644c 100644 --- a/sys/kern/subr_rman.c +++ b/sys/kern/subr_rman.c @@ -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; |