15489 cfgadm_plugins: the comparison will always evaluate as 'true'
Reviewed by: Dan Cross <cross@oxidecomputer.com>
Reviewed by: Gergő Mihály Doma <domag02@gmail.com>
Approved by: Robert Mustacchi <rm@fingolfin.org>
diff --git a/usr/src/lib/cfgadm_plugins/pci/common/cfga.c b/usr/src/lib/cfgadm_plugins/pci/common/cfga.c
index 39417d1..1a0ca0c 100644
--- a/usr/src/lib/cfgadm_plugins/pci/common/cfga.c
+++ b/usr/src/lib/cfgadm_plugins/pci/common/cfga.c
@@ -84,7 +84,7 @@
 /*
  *	DEBUGING LEVEL
  *
- * 	External routines:  1 - 2
+ *	External routines:  1 - 2
  *	Internal routines:  3 - 4
  */
 #ifdef	PCIHP_DBG
@@ -1293,7 +1293,7 @@
 
 	di_prom_fini(slotarg->promp);
 	di_fini(root_node);
-	if (slotarg->slotnames[0] != NULL)
+	if (*slotarg->slotnames[0] != '\0')
 		return (0);
 	else
 		return (-1);
@@ -1685,6 +1685,7 @@
 
 	if ((*cs)->ap_info[0] == '\0') {
 		/* slot_names of bus node  */
+		memset(&slotname_arg, 0, sizeof (slotname_arg));
 		if (find_physical_slot_names(ap_id, &slotname_arg) != -1)
 			(void) strcpy((*cs)->ap_info,
 			    slotname_arg.slotnames[slotname_arg.minor]);
diff --git a/usr/src/lib/cfgadm_plugins/shp/common/shp.c b/usr/src/lib/cfgadm_plugins/shp/common/shp.c
index b1ee7d1..669f498 100644
--- a/usr/src/lib/cfgadm_plugins/shp/common/shp.c
+++ b/usr/src/lib/cfgadm_plugins/shp/common/shp.c
@@ -91,7 +91,7 @@
 /*
  *	DEBUGING LEVEL
  *
- * 	External routines:  1 - 2
+ *	External routines:  1 - 2
  *	Internal routines:  3 - 4
  */
 #ifdef	SHP_DBG
@@ -354,7 +354,7 @@
 error_sizeup_cb(hp_node_t node, void *arg)
 {
 	error_size_cb_arg_t	*sizearg = (error_size_cb_arg_t *)arg;
-	size_t 			len;
+	size_t			len;
 
 	/* Only process USAGE nodes */
 	if (hp_type(node) != HP_NODE_USAGE)
@@ -1163,7 +1163,7 @@
 
 	di_prom_fini(slotarg->promp);
 	di_fini(root_node);
-	if (slotarg->slotnames[0] != NULL)
+	if (*slotarg->slotnames[0] != '\0')
 		return (0);
 	else
 		return (-1);
@@ -1535,6 +1535,7 @@
 
 	if ((*cs)->ap_info[0] == '\0') {
 		/* slot_names of bus node  */
+		memset(&slotname_arg, 0, sizeof (slotname_arg));
 		if (find_physical_slot_names(ap_id, &slotname_arg) != -1)
 			(void) strcpy((*cs)->ap_info,
 			    slotname_arg.slotnames[slotname_arg.minor]);