summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-01-24 16:11:17 +0200
committerToomas Soome <tsoome@me.com>2019-07-12 08:58:51 +0300
commit940f2f5868892c7a40e071319100921b5b859283 (patch)
treefedc57af045acb93736eef6749b574efa0c1f67b
parent0ab8aa7074d0531c1e2453adcf08e519888b024d (diff)
downloadillumos-joyent-940f2f5868892c7a40e071319100921b5b859283.tar.gz
11344 fm: NULL pointer errors
Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/cmd/fm/fmadm/common/faulty.c6
-rw-r--r--usr/src/cmd/fm/fmd/common/fmd_mdb.c40
-rw-r--r--usr/src/cmd/fm/modules/common/eversholt/eft_mdb.c6
-rw-r--r--usr/src/cmd/fm/modules/common/fabric-xlate/fx_fabric.c22
-rw-r--r--usr/src/cmd/fm/modules/common/fabric-xlate/fx_fire.c8
-rw-r--r--usr/src/cmd/fm/modules/common/fdd-msg/fdd_msg.c2
-rw-r--r--usr/src/cmd/fm/modules/common/ip-transport/ip.c21
-rw-r--r--usr/src/cmd/fm/modules/common/sensor-transport/sensor_transport.c2
8 files changed, 54 insertions, 53 deletions
diff --git a/usr/src/cmd/fm/fmadm/common/faulty.c b/usr/src/cmd/fm/fmadm/common/faulty.c
index 72a8dffb4b..21d4143532 100644
--- a/usr/src/cmd/fm/fmadm/common/faulty.c
+++ b/usr/src/cmd/fm/fmadm/common/faulty.c
@@ -133,7 +133,7 @@
* associated with this fault
*
* Action : Schedule a repair procedure to replace the affected device.
- * Use fmdump -v -u <EVENT_ID> to identify the device or contact
+ * Use fmdump -v -u <EVENT_ID> to identify the device or contact
* Sun for support.
*
* The -r flag changes the output so that it appears sorted on a per-asru basis.
@@ -909,7 +909,7 @@ print_line(char *label, char *buf)
while (c) {
i = lsz;
wp = NULL;
- while ((c = *ep) != NULL && (wp == NULL || i < 80)) {
+ while ((c = *ep) != '\0' && (wp == NULL || i < 80)) {
if (c == ' ')
wp = ep;
else if (c == '\n') {
@@ -917,7 +917,7 @@ print_line(char *label, char *buf)
*ep = 0;
do {
ep++;
- } while ((c = *ep) != NULL && c == ' ');
+ } while ((c = *ep) != '\0' && c == ' ');
break;
}
ep++;
diff --git a/usr/src/cmd/fm/fmd/common/fmd_mdb.c b/usr/src/cmd/fm/fmd/common/fmd_mdb.c
index 0d04f80827..8ad141ab27 100644
--- a/usr/src/cmd/fm/fmd/common/fmd_mdb.c
+++ b/usr/src/cmd/fm/fmd/common/fmd_mdb.c
@@ -69,7 +69,7 @@ trwalk_init(mdb_walk_state_t *wsp)
fmd_thread_t thr;
fmd_t F;
- if (wsp->walk_addr != NULL) {
+ if (wsp->walk_addr != 0) {
mdb_warn("fmd_trace only supports global walks\n");
return (WALK_ERR);
}
@@ -79,7 +79,7 @@ trwalk_init(mdb_walk_state_t *wsp)
return (WALK_ERR);
}
- for (addr = (uintptr_t)F.d_thr_list.l_next; addr != NULL;
+ for (addr = (uintptr_t)F.d_thr_list.l_next; addr != 0;
addr = (uintptr_t)thr.thr_list.l_next) {
size_t len, ptr_off, end_off;
@@ -335,7 +335,7 @@ hash_walk_step(mdb_walk_state_t *wsp)
hashwalk_data_t *hwp = wsp->walk_data;
int rv;
- while (wsp->walk_addr == NULL) {
+ while (wsp->walk_addr == 0) {
if (++hwp->hw_hashidx < hwp->hw_hashlen)
wsp->walk_addr = hwp->hw_hash[hwp->hw_hashidx];
else
@@ -384,7 +384,7 @@ ustat_walk_step(mdb_walk_state_t *wsp)
fmd_ustat_elem_t ue;
fmd_stat_t s;
- while (wsp->walk_addr == NULL) {
+ while (wsp->walk_addr == 0) {
if (++hwp->hw_hashidx < hwp->hw_hashlen)
wsp->walk_addr = hwp->hw_hash[hwp->hw_hashidx];
else
@@ -680,7 +680,7 @@ thread_walk_step(mdb_walk_state_t *wsp)
uintptr_t addr = wsp->walk_addr;
fmd_thread_t t;
- if (addr == NULL)
+ if (addr == 0)
return (WALK_DONE);
if (mdb_vread(&t, sizeof (t), addr) != sizeof (t)) {
@@ -739,7 +739,7 @@ mod_walk_step(mdb_walk_state_t *wsp)
uintptr_t addr = wsp->walk_addr;
fmd_module_t m;
- if (addr == NULL)
+ if (addr == 0)
return (WALK_DONE);
if (mdb_vread(&m, sizeof (m), addr) != sizeof (m)) {
@@ -789,7 +789,7 @@ case_walk_init(mdb_walk_state_t *wsp)
fmd_case_hash_t ch;
fmd_t F;
- if (wsp->walk_addr != NULL) {
+ if (wsp->walk_addr != 0) {
if (mdb_vread(&mod, sizeof (mod), wsp->walk_addr) == -1) {
mdb_warn("failed to read module at %p", wsp->walk_addr);
return (WALK_ERR);
@@ -819,7 +819,7 @@ case_walk_step(mdb_walk_state_t *wsp)
if (wsp->walk_data != NULL)
return (hash_walk_step(wsp));
- if (addr == NULL)
+ if (addr == 0)
return (WALK_DONE);
if (mdb_vread(&ci, sizeof (ci), addr) != sizeof (ci)) {
@@ -1009,12 +1009,12 @@ asru_walk_init(mdb_walk_state_t *wsp)
fmd_asru_hash_t ah;
fmd_t F;
- if (wsp->walk_addr == NULL && mdb_readvar(&F, "fmd") != sizeof (F)) {
+ if (wsp->walk_addr == 0 && mdb_readvar(&F, "fmd") != sizeof (F)) {
mdb_warn("failed to read fmd meta-data");
return (WALK_ERR);
}
- if (wsp->walk_addr == NULL)
+ if (wsp->walk_addr == 0)
wsp->walk_addr = (uintptr_t)F.d_asrus;
if (mdb_vread(&ah, sizeof (ah), wsp->walk_addr) != sizeof (ah)) {
@@ -1063,12 +1063,12 @@ al_walk_init(mdb_walk_state_t *wsp)
fmd_asru_hash_t ah;
fmd_t F;
- if (wsp->walk_addr == NULL && mdb_readvar(&F, "fmd") != sizeof (F)) {
+ if (wsp->walk_addr == 0 && mdb_readvar(&F, "fmd") != sizeof (F)) {
mdb_warn("failed to read fmd meta-data");
return (WALK_ERR);
}
- if (wsp->walk_addr == NULL)
+ if (wsp->walk_addr == 0)
wsp->walk_addr = (uintptr_t)F.d_asrus;
if (mdb_vread(&ah, sizeof (ah), wsp->walk_addr) != sizeof (ah)) {
@@ -1364,12 +1364,12 @@ tmq_walk_init(mdb_walk_state_t *wsp)
fmd_timerq_t tmq;
fmd_t F;
- if (wsp->walk_addr == NULL && mdb_readvar(&F, "fmd") != sizeof (F)) {
+ if (wsp->walk_addr == 0 && mdb_readvar(&F, "fmd") != sizeof (F)) {
mdb_warn("failed to read fmd meta-data");
return (WALK_ERR);
}
- if (wsp->walk_addr == NULL)
+ if (wsp->walk_addr == 0)
wsp->walk_addr = (uintptr_t)F.d_timers;
if (mdb_vread(&tmq, sizeof (tmq), wsp->walk_addr) != sizeof (tmq)) {
@@ -1387,7 +1387,7 @@ tmq_walk_step(mdb_walk_state_t *wsp)
uintptr_t addr = wsp->walk_addr;
fmd_timer_t tmr;
- if (addr == NULL)
+ if (addr == 0)
return (WALK_DONE);
if (mdb_vread(&tmr, sizeof (tmr), addr) != sizeof (tmr)) {
@@ -1441,7 +1441,7 @@ xprt_walk_init(mdb_walk_state_t *wsp)
{
fmd_module_t m;
- if (wsp->walk_addr == NULL) {
+ if (wsp->walk_addr == 0) {
mdb_warn("transport walker requires fmd_module_t address\n");
return (WALK_ERR);
}
@@ -1461,7 +1461,7 @@ xprt_walk_step(mdb_walk_state_t *wsp)
uintptr_t addr = wsp->walk_addr;
fmd_xprt_impl_t xi;
- if (addr == NULL)
+ if (addr == 0)
return (WALK_DONE);
if (mdb_vread(&xi, sizeof (xi), addr) != sizeof (xi)) {
@@ -1587,7 +1587,7 @@ tsnap_walk_step(mdb_walk_state_t *wsp)
uintptr_t addr = wsp->walk_addr;
fmd_topo_t ftp;
- if (addr == NULL)
+ if (addr == 0)
return (WALK_DONE);
if (mdb_vread(&ftp, sizeof (ftp), addr) != sizeof (ftp)) {
@@ -1605,7 +1605,7 @@ mq_walk_init(mdb_walk_state_t *wsp)
fmd_module_t m;
struct fmd_eventq eq;
- if (wsp->walk_addr == NULL) {
+ if (wsp->walk_addr == 0) {
mdb_warn("NULL fmd_module_t passed in");
return (WALK_ERR);
}
@@ -1631,7 +1631,7 @@ mq_walk_step(mdb_walk_state_t *wsp)
uintptr_t addr = wsp->walk_addr;
fmd_eventqelem_t eqe;
- if (addr == NULL)
+ if (addr == 0)
return (WALK_DONE);
if (mdb_vread(&eqe, sizeof (eqe), addr) != sizeof (eqe)) {
diff --git a/usr/src/cmd/fm/modules/common/eversholt/eft_mdb.c b/usr/src/cmd/fm/modules/common/eversholt/eft_mdb.c
index 913f16c6b5..4b50777c14 100644
--- a/usr/src/cmd/fm/modules/common/eversholt/eft_mdb.c
+++ b/usr/src/cmd/fm/modules/common/eversholt/eft_mdb.c
@@ -130,7 +130,7 @@ lut_collect(uintptr_t addr, struct lut_dump_desc *lddp)
static int
lut_walk_init(mdb_walk_state_t *wsp)
{
- if (wsp->walk_addr == NULL) {
+ if (wsp->walk_addr == 0) {
mdb_warn("lut walker requires a lut table address\n");
return (WALK_ERR);
}
@@ -269,7 +269,7 @@ eft_count(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
if (mdb_vread(&addr, sizeof (addr),
(uintptr_t)sym.st_value) != sizeof (addr))
return (DCMD_ERR);
- if (addr == NULL)
+ if (addr == 0)
return (DCMD_OK);
if (mdb_pwalk_dcmd("lut", "eft_count", argc, argv, addr) != 0)
return (DCMD_ERR);
@@ -373,7 +373,7 @@ eft_node(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
return (DCMD_USAGE);
}
}
- if (addr == NULL)
+ if (addr == 0)
return (DCMD_OK);
if (mdb_vread(&node, sizeof (node), addr) != sizeof (node)) {
mdb_warn("failed to read struct node at %p", addr);
diff --git a/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fabric.c b/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fabric.c
index 5766d86f7d..69ecf1aa8d 100644
--- a/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fabric.c
+++ b/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fabric.c
@@ -50,7 +50,7 @@ fab_erpt_tbl_t fab_pci_erpt_tbl[] = {
PCI_MA, PCI_STAT_R_MAST_AB, NULL,
PCI_REC_TA, PCI_STAT_R_TARG_AB, NULL,
PCI_SIG_TA, PCI_STAT_S_TARG_AB, NULL,
- NULL, NULL, NULL
+ NULL, 0, NULL
};
/* Translate Fabric ereports to ereport.io.pci.sec-* */
@@ -63,14 +63,14 @@ static fab_erpt_tbl_t fab_pci_bdg_erpt_tbl[] = {
#endif
PCI_REC_TA, PCI_STAT_R_TARG_AB, NULL,
PCI_SIG_TA, PCI_STAT_S_TARG_AB, NULL,
- NULL, NULL, NULL, NULL,
+ NULL, 0, NULL,
};
/* Translate Fabric ereports to ereport.io.pci.dto */
static fab_erpt_tbl_t fab_pci_bdg_ctl_erpt_tbl[] = {
PCI_DTO, PCI_BCNF_BCNTRL_DTO_STAT, NULL,
- NULL, NULL, NULL
+ NULL, 0, NULL
};
/* Translate Fabric ereports to ereport.io.pciex.* */
@@ -81,7 +81,7 @@ static fab_erpt_tbl_t fab_pcie_ce_erpt_tbl[] = {
PCIEX_BDP, PCIE_AER_CE_BAD_DLLP, NULL,
PCIEX_BTP, PCIE_AER_CE_BAD_TLP, NULL,
PCIEX_ANFE, PCIE_AER_CE_AD_NFE, NULL,
- NULL, NULL, NULL
+ NULL, 0, NULL
};
/*
@@ -104,7 +104,7 @@ static fab_erpt_tbl_t fab_pcie_ue_erpt_tbl[] = {
PCIEX_UR, PCIE_AER_UCE_UR, PCI_TARG_MA,
#endif
PCIEX_POIS, PCIE_AER_UCE_PTLP, PCI_TARG_MDPE,
- NULL, NULL, NULL
+ NULL, 0, NULL
};
/* Translate Fabric ereports to ereport.io.pciex.* */
@@ -124,7 +124,7 @@ static fab_erpt_tbl_t fab_pcie_sue_erpt_tbl[] = {
PCIEX_S_PERR, PCIE_AER_SUCE_PERR_ASSERT, PCI_TARG_MDPE,
PCIEX_S_SERR, PCIE_AER_SUCE_SERR_ASSERT, NULL,
PCIEX_INTERR, PCIE_AER_SUCE_INTERNAL_ERR, NULL,
- NULL, NULL, NULL
+ NULL, 0, NULL
};
/* Translate Fabric ereports to ereport.io.pcix.* */
@@ -132,7 +132,7 @@ static fab_erpt_tbl_t fab_pcix_erpt_tbl[] = {
PCIX_SPL_DIS, PCI_PCIX_SPL_DSCD, NULL,
PCIX_UNEX_SPL, PCI_PCIX_UNEX_SPL, NULL,
PCIX_RX_SPL_MSG, PCI_PCIX_RX_SPL_MSG, NULL,
- NULL, NULL, NULL
+ NULL, 0, NULL
};
static fab_erpt_tbl_t *fab_pcix_bdg_erpt_tbl = fab_pcix_erpt_tbl;
@@ -142,7 +142,7 @@ static fab_erpt_tbl_t fab_pcix_bdg_sec_erpt_tbl[] = {
PCIX_UNEX_SPL, PCI_PCIX_BSS_UNEX_SPL, NULL,
PCIX_BSS_SPL_OR, PCI_PCIX_BSS_SPL_OR, NULL,
PCIX_BSS_SPL_DLY, PCI_PCIX_BSS_SPL_DLY, NULL,
- NULL, NULL, NULL
+ NULL, 0, NULL
};
/* Translate Fabric ereports to ereport.io.pciex.* */
@@ -153,7 +153,7 @@ static fab_erpt_tbl_t fab_pcie_nadv_erpt_tbl[] = {
PCIEX_FAT, PCIE_DEVSTS_FE_DETECTED, NULL,
PCIEX_NONFAT, PCIE_DEVSTS_NFE_DETECTED, NULL,
PCIEX_CORR, PCIE_DEVSTS_CE_DETECTED, NULL,
- NULL, NULL, NULL
+ NULL, 0, NULL
};
/* Translate Fabric ereports to ereport.io.pciex.* */
@@ -163,7 +163,7 @@ static fab_erpt_tbl_t fab_pcie_rc_erpt_tbl[] = {
PCIEX_RC_CE_MSG, PCIE_AER_RE_STS_CE_RCVD, NULL,
PCIEX_RC_MCE_MSG, PCIE_AER_RE_STS_MUL_CE_RCVD, NULL,
PCIEX_RC_MUE_MSG, PCIE_AER_RE_STS_MUL_FE_NFE_RCVD, NULL,
- NULL, NULL, NULL
+ NULL, 0, NULL
};
/*
@@ -175,7 +175,7 @@ static fab_erpt_tbl_t fab_pcie_fake_rc_erpt_tbl[] = {
PCIEX_RC_FE_MSG, PCIE_DEVSTS_FE_DETECTED, NULL,
PCIEX_RC_NFE_MSG, PCIE_DEVSTS_NFE_DETECTED, NULL,
PCIEX_RC_CE_MSG, PCIE_DEVSTS_CE_DETECTED, NULL,
- NULL, NULL, NULL,
+ NULL, 0, NULL,
};
/* ARGSUSED */
diff --git a/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fire.c b/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fire.c
index f508f24569..232cad9683 100644
--- a/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fire.c
+++ b/usr/src/cmd/fm/modules/common/fabric-xlate/fx_fire.c
@@ -66,7 +66,7 @@ static fab_fire_tbl_t fab_fire_pec_ue_tbl[] = {
FAB_FIRE_UE(TE, TRAINING, PCI_STAT_S_SYSERR, 0),
FAB_FIRE_UE(CA, CA, PCI_STAT_S_TARG_AB,
PCI_STAT_S_TARG_AB),
- NULL, NULL, NULL,
+ NULL, 0, 0,
};
#define FAB_FIRE_CE(fb, bit) \
@@ -77,7 +77,7 @@ static fab_fire_tbl_t fab_fire_pec_ce_tbl[] = {
FAB_FIRE_CE(BDP, BAD_DLLP),
FAB_FIRE_CE(BTP, BAD_TLP),
FAB_FIRE_CE(RE, RECEIVER_ERR),
- NULL, NULL, NULL,
+ NULL, 0, 0,
};
/*
@@ -97,7 +97,7 @@ static fab_fire_tbl_t fab_fire_pec_oe_tbl[] = {
FAB_FIRE_OE(ERO, DLP),
FAB_FIRE_OE(EMP, DLP),
FAB_FIRE_OE(EPE, DLP),
- NULL, NULL, NULL,
+ NULL, 0, 0,
};
#define FAB_FIRE_DMC(fb) \
@@ -115,7 +115,7 @@ static fab_fire_tbl_t fab_fire_dmc_tbl[] = {
FAB_N2_DMU("sun4v_inv_pg_sz"),
FAB_N2_DMU("sun4v_key_err"),
FAB_N2_DMU("sun4v_va_oor"),
- NULL, NULL, NULL
+ NULL, 0, 0
};
/* ARGSUSED */
diff --git a/usr/src/cmd/fm/modules/common/fdd-msg/fdd_msg.c b/usr/src/cmd/fm/modules/common/fdd-msg/fdd_msg.c
index b618de53e0..73db613f99 100644
--- a/usr/src/cmd/fm/modules/common/fdd-msg/fdd_msg.c
+++ b/usr/src/cmd/fm/modules/common/fdd-msg/fdd_msg.c
@@ -72,7 +72,7 @@ static cpu_tbl_t fma_cap_list[] = {
{"GenuineIntel", 6, 46, "NHMEX_fma_cap"},
{"GenuineIntel", 6, 44, "WSMEP_fma_cap"},
{"GenuineIntel", 6, 47, "INTLN_fma_cap"},
- {NULL, 0, 0, NULL}
+ {0, 0, 0, 0}
};
#endif
diff --git a/usr/src/cmd/fm/modules/common/ip-transport/ip.c b/usr/src/cmd/fm/modules/common/ip-transport/ip.c
index ea05fc8c28..36adc5eaf3 100644
--- a/usr/src/cmd/fm/modules/common/ip-transport/ip.c
+++ b/usr/src/cmd/fm/modules/common/ip-transport/ip.c
@@ -852,7 +852,8 @@ ip_start_connections()
* connecting to the server.
*/
static void
-ip_timeout(fmd_hdl_t *hdl, id_t id, void *arg) {
+ip_timeout(fmd_hdl_t *hdl, id_t id, void *arg)
+{
int install_timer;
ip_cinfo_t *cinfo;
ip_xprt_t *ipx;
@@ -861,33 +862,33 @@ ip_timeout(fmd_hdl_t *hdl, id_t id, void *arg) {
fmd_hdl_error(hdl, "ip_timeout failed because hg arg is NULL");
} else if (ip_argis_cinfo(arg)) {
ip_debug(IP_DEBUG_FINER,
- "Enter ip_timeout (a) install new timer");
+ "Enter ip_timeout (a) install new timer");
cinfo = arg;
if ((ip_xprt_setup(hdl, arg) != 0) && !ip_quit)
cinfo->ipc_timer = fmd_timer_install(
- hdl, cinfo, NULL, ip_sleep);
+ hdl, cinfo, NULL, ip_sleep);
else
- cinfo->ipc_timer = NULL;
+ cinfo->ipc_timer = 0;
} else {
ipx = arg;
if (ipx->ipx_flags & FMD_XPRT_SUSPENDED) {
- ipx->ipx_spnd_timer = NULL;
+ ipx->ipx_spnd_timer = 0;
ip_debug(IP_DEBUG_FINE, "timer %d waking ipx %p",
- (int)id, arg);
+ (int)id, arg);
ipx->ipx_flags &= ~FMD_XPRT_SUSPENDED;
fmd_xprt_resume(hdl, ipx->ipx_xprt);
} else {
ip_debug(IP_DEBUG_FINE, "timer %d closing ipx %p",
- (int)id, arg);
+ (int)id, arg);
cinfo = ipx->ipx_cinfo;
install_timer = (ipx->ipx_flags & FMD_XPRT_ACCEPT) !=
- FMD_XPRT_ACCEPT;
+ FMD_XPRT_ACCEPT;
ip_xprt_destroy(ipx);
if (install_timer && !ip_quit)
cinfo->ipc_timer = fmd_timer_install(
- hdl, cinfo, NULL, ip_sleep);
+ hdl, cinfo, NULL, ip_sleep);
else
- cinfo->ipc_timer = NULL;
+ cinfo->ipc_timer = 0;
}
}
}
diff --git a/usr/src/cmd/fm/modules/common/sensor-transport/sensor_transport.c b/usr/src/cmd/fm/modules/common/sensor-transport/sensor_transport.c
index 50383d4530..10177bd623 100644
--- a/usr/src/cmd/fm/modules/common/sensor-transport/sensor_transport.c
+++ b/usr/src/cmd/fm/modules/common/sensor-transport/sensor_transport.c
@@ -388,7 +388,7 @@ parse_spoof_param(fmd_hdl_t *hdl, char *param, sensor_transport_t *stp)
char *sensor, *last_sensor, *field, *last_field;
nvlist_t *spoof;
- if (nvlist_alloc(&stp->st_spoofs, NV_UNIQUE_NAME, 0) != NULL) {
+ if (nvlist_alloc(&stp->st_spoofs, NV_UNIQUE_NAME, 0) != 0) {
return (-1);
}