summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorcth <none@none>2005-07-29 10:48:45 -0700
committercth <none@none>2005-07-29 10:48:45 -0700
commit10302a14980e13ad53d6f3488d6c67701e4dad52 (patch)
treeb973e4a6d1ba395c36a0ef0d51d59e6608444ffe /usr/src
parent3677cad460dda50d22a04d36a3f544a82344d940 (diff)
downloadillumos-joyent-10302a14980e13ad53d6f3488d6c67701e4dad52.tar.gz
6263194 Nothing prevents pcihp_list_occupants from setting ctrl->occupant->i >= HPC_MAX_OCCUPANTS
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/common/io/hotplug/pcihp/pcihp.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/usr/src/uts/common/io/hotplug/pcihp/pcihp.c b/usr/src/uts/common/io/hotplug/pcihp/pcihp.c
index 07506e4e88..91a081016c 100644
--- a/usr/src/uts/common/io/hotplug/pcihp/pcihp.c
+++ b/usr/src/uts/common/io/hotplug/pcihp/pcihp.c
@@ -20,7 +20,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -653,13 +653,24 @@ pcihp_list_occupants(dev_info_t *dip, void *hdl)
if ((major == -1) || (i_ddi_node_state(dip) < DS_ATTACHED))
return (DDI_WALK_PRUNECHILD);
- ctrl->occupant->id[ctrl->occupant->i] =
- kmem_alloc(sizeof (char[MAXPATHLEN]), KM_SLEEP);
+ /*
+ * If we have used all our occupants then print mesage
+ * and terminate walk.
+ */
+ if (ctrl->occupant->i >= HPC_MAX_OCCUPANTS) {
+ cmn_err(CE_WARN,
+ "pcihp (%s%d): unable to list all occupants",
+ ddi_driver_name(ddi_get_parent(dip)),
+ ddi_get_instance(ddi_get_parent(dip)));
+ return (DDI_WALK_TERMINATE);
+ }
/*
* No need to hold the dip as ddi_walk_devs
* has already arranged that for us.
*/
+ ctrl->occupant->id[ctrl->occupant->i] =
+ kmem_alloc(sizeof (char[MAXPATHLEN]), KM_SLEEP);
(void) ddi_pathname(dip,
(char *)ctrl->occupant->id[ctrl->occupant->i]);
ctrl->occupant->i++;