summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-04-11 09:52:50 +0300
committerToomas Soome <tsoome@me.com>2020-04-24 20:53:03 +0300
commit67dca347c78f6433be936f7be1c9bbf7069a19ec (patch)
tree247c4f317dddb9f0e6b54062bc33e7eb2859681d /usr/src
parentcd8579f741f9678d47f40aa55c57144419a78b13 (diff)
downloadillumos-joyent-67dca347c78f6433be936f7be1c9bbf7069a19ec.tar.gz
12534 fm: NULL pointer errors
Reviewed by: Gary Mills <gary_mills@fastmail.fm> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpu.c2
-rw-r--r--usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpuerr.c5
-rw-r--r--usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_memerr.c2
-rw-r--r--usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_memerr_arch.c9
-rw-r--r--usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_memerr_arch.c21
-rw-r--r--usr/src/cmd/fm/modules/sun4v/etm/etm.c75
-rw-r--r--usr/src/lib/fm/libldom/sparc/ldom_xmpp_client.c4
-rw-r--r--usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_walker.c4
8 files changed, 63 insertions, 59 deletions
diff --git a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpu.c b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpu.c
index a86318e0bc..266af44b0d 100644
--- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpu.c
+++ b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpu.c
@@ -1313,7 +1313,7 @@ cmd_trw_alloc(uint64_t ena, uint64_t afar)
for (i = 0; i < cmd.cmd_xxcu_ntrw; i++) {
cmd_xxcu_trw_t *trw = &cmd.cmd_xxcu_trw[i];
- if (trw->trw_ena == NULL) {
+ if (trw->trw_ena == 0) {
trw->trw_ena = ena;
trw->trw_afar = afar;
return (trw);
diff --git a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpuerr.c b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpuerr.c
index 25ea7bdfb3..711624846c 100644
--- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpuerr.c
+++ b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_cpuerr.c
@@ -267,6 +267,7 @@ cmd_nop_hdlr(fmd_hdl_t *hdl, cmd_xr_t *xr, fmd_event_t *ep)
fmd_hdl_debug(hdl, "nop train resolved for clcode %llx\n",
xr->xr_clcode);
}
+
/*ARGSUSED*/
static void
cmd_xxu_hdlr(fmd_hdl_t *hdl, cmd_xr_t *xr, fmd_event_t *ep)
@@ -399,7 +400,7 @@ cmd_xxcu_resolve(fmd_hdl_t *hdl, cmd_xr_t *xr, fmd_event_t *ep,
uint64_t afar;
- afar = NULL;
+ afar = 0;
if (xr->xr_afar_status == AFLT_STAT_VALID)
afar = xr->xr_afar;
@@ -500,7 +501,7 @@ cmd_xxcu_initial(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
if (cmd_afar_valid(hdl, nvl, clcode, &afar) != 0) {
afar_status = AFLT_STAT_INVALID;
- afar = NULL;
+ afar = 0;
} else {
afar_status = AFLT_STAT_VALID;
}
diff --git a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_memerr.c b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_memerr.c
index 5ef66b5b42..7258d7860a 100644
--- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_memerr.c
+++ b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_memerr.c
@@ -868,7 +868,7 @@ cmd_ue_common(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
if (fmd_nvl_fmri_expand(hdl, asru) < 0) {
CMD_STAT_BUMP(bad_mem_asru);
- return (NULL);
+ return (CMD_EVD_BAD);
}
if ((bank = cmd_bank_lookup(hdl, asru)) == NULL &&
diff --git a/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_memerr_arch.c b/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_memerr_arch.c
index 431b7459c9..448852c4c4 100644
--- a/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_memerr_arch.c
+++ b/usr/src/cmd/fm/modules/sun4u/cpumem-diagnosis/cmd_memerr_arch.c
@@ -345,8 +345,8 @@ cmd_ioxefrx_fire(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl,
(void) nvlist_lookup_uint64(nvl, FIRE_JBC_JITEL1, &afar);
rferr->rf_afar = afar & FIRE_JBC_ADDR_MASK;
- rferr->rf_afsr = NULL;
- rferr->rf_synd = NULL;
+ rferr->rf_afsr = 0;
+ rferr->rf_synd = 0;
if (nvlist_lookup_string(nvl, FM_EREPORT_PAYLOAD_NAME_ERR_TYPE,
&typenm) == 0)
@@ -624,7 +624,8 @@ int msynd2bit [] = { /* msynd 0-F */
};
int
-cmd_synd2upos(uint16_t syndrome) {
+cmd_synd2upos(uint16_t syndrome)
+{
return (esynd2bit[syndrome]);
}
@@ -647,7 +648,7 @@ struct plat2id_map {
{"SUNW,Sun-Fire-15000", 1},
{"SUNW,Sun-Fire", 2},
{"SUNW,Netra-T12", 2},
- {"SUNW,Sun-Fire-480R", 3},
+ {"SUNW,Sun-Fire-480R", 3},
{"SUNW,Sun-Fire-V490", 3},
{"SUNW,Sun-Fire-V440", 3},
{"SUNW,Sun-Fire-V445", 3},
diff --git a/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_memerr_arch.c b/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_memerr_arch.c
index b8005adff2..d784fb4c91 100644
--- a/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_memerr_arch.c
+++ b/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_memerr_arch.c
@@ -64,7 +64,7 @@
#define FBR_ERROR ".fbr"
#define DSU_ERROR ".dsu"
#define FERG_INVALID ".invalid"
-#define DBU_ERROR ".dbu"
+#define DBU_ERROR ".dbu"
extern ldom_hdl_t *cpumem_diagnosis_lhp;
@@ -367,17 +367,17 @@ cmd_fb(fmd_hdl_t *hdl, fmd_event_t *ep, nvlist_t *nvl, const char *class,
if (nvlist_lookup_nvlist(nvl, FM_RSRC_RESOURCE, &asru) < 0) {
CMD_STAT_BUMP(bad_mem_asru);
- return (NULL);
+ return (CMD_EVD_UNUSED);
}
if (nvlist_lookup_nvlist(nvl, FM_EREPORT_DETECTOR, &det) < 0) {
CMD_STAT_BUMP(bad_mem_asru);
- return (NULL);
+ return (CMD_EVD_UNUSED);
}
if (fmd_nvl_fmri_expand(hdl, det) < 0) {
fmd_hdl_debug(hdl, "Failed to expand detector");
- return (NULL);
+ return (CMD_EVD_UNUSED);
}
branch = cmd_branch_lookup(hdl, asru);
@@ -612,12 +612,13 @@ static int galois_mul[16][16] = {
};
static int
-galois_div(int num, int denom) {
+galois_div(int num, int denom)
+{
int i;
for (i = 0; i < 16; i++) {
if (galois_mul[denom][i] == num)
- return (i);
+ return (i);
}
return (-1);
}
@@ -628,8 +629,8 @@ galois_div(int num, int denom) {
*/
int
-cmd_synd2upos(uint16_t syndrome) {
-
+cmd_synd2upos(uint16_t syndrome)
+{
uint16_t s0, s1, s2, s3;
if (syndrome == 0)
@@ -672,8 +673,8 @@ cmd_synd2upos(uint16_t syndrome) {
}
nvlist_t *
-cmd_mem2hc(fmd_hdl_t *hdl, nvlist_t *mem_fmri) {
-
+cmd_mem2hc(fmd_hdl_t *hdl, nvlist_t *mem_fmri)
+{
char **snp;
uint_t n;
diff --git a/usr/src/cmd/fm/modules/sun4v/etm/etm.c b/usr/src/cmd/fm/modules/sun4v/etm/etm.c
index 09ea0549f0..ff50c2a888 100644
--- a/usr/src/cmd/fm/modules/sun4v/etm/etm.c
+++ b/usr/src/cmd/fm/modules/sun4v/etm/etm.c
@@ -179,10 +179,10 @@ static fmd_xprt_t
*etm_fmd_xprt = NULL; /* FMD transport layer handle */
static pthread_t
-etm_svr_tid = NULL; /* thread id of connection acceptance server */
+etm_svr_tid = 0; /* thread id of connection acceptance server */
static pthread_t
-etm_resp_tid = NULL; /* thread id of msg responder */
+etm_resp_tid = 0; /* thread id of msg responder */
static etm_resp_q_ele_t
*etm_resp_q_head = NULL; /* ptr to cur head of responder queue */
@@ -554,7 +554,7 @@ static pthread_mutex_t
iosvc_list_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_t
-etm_async_e_tid = NULL; /* thread id of io svc async event handler */
+etm_async_e_tid = 0; /* thread id of io svc async event handler */
static etm_proto_v1_ev_hdr_t iosvc_hdr = {
ETM_PROTO_MAGIC_NUM, /* magic number */
@@ -587,8 +587,8 @@ static etm_iosvc_t io_svc = {
0, /* xid of last event posted to FMD */
DS_INVALID_HDL, /* DS handle */
NULL, /* fmd xprt handle */
- NULL, /* tid 4 send to remote RootDomain */
- NULL, /* tid 4 recv from remote RootDomain */
+ 0, /* tid 4 send to remote RootDomain */
+ 0, /* tid 4 recv from remote RootDomain */
PTHREAD_COND_INITIALIZER, /* nudges etm_send_to_remote_root */
PTHREAD_MUTEX_INITIALIZER, /* protects msg_ack_cv */
0, /* send/recv threads are not dying */
@@ -756,7 +756,7 @@ etm_sleep(unsigned sleep_sec)
static int
etm_conn_open(fmd_hdl_t *hdl, char *err_substr,
- etm_xport_addr_t addr, etm_xport_conn_t *connp)
+ etm_xport_addr_t addr, etm_xport_conn_t *connp)
{
etm_xport_conn_t conn; /* connection to return */
int nev; /* -errno value */
@@ -810,7 +810,7 @@ etm_conn_close(fmd_hdl_t *hdl, char *err_substr, etm_xport_conn_t conn)
static ssize_t
etm_io_op(fmd_hdl_t *hdl, char *err_substr, etm_xport_conn_t conn,
- void *buf, size_t byte_cnt, int io_op)
+ void *buf, size_t byte_cnt, int io_op)
{
ssize_t rv; /* ret val / byte count */
ssize_t n; /* gen use */
@@ -1013,7 +1013,7 @@ etm_hdr_read(fmd_hdl_t *hdl, etm_xport_conn_t conn, size_t *szp)
{
uint8_t *hdrp; /* ptr to header to return */
size_t hdr_sz; /* sizeof *hdrp */
- etm_proto_v1_pp_t pp; /* protocol preamble */
+ etm_proto_v1_pp_t pp; /* protocol preamble */
etm_proto_v1_ev_hdr_t *ev_hdrp; /* for FMA_EVENT msg */
etm_proto_v1_ctl_hdr_t *ctl_hdrp; /* for CONTROL msg */
etm_proto_v1_resp_hdr_t *resp_hdrp; /* for RESPONSE msg */
@@ -1237,7 +1237,7 @@ etm_hdr_read(fmd_hdl_t *hdl, etm_xport_conn_t conn, size_t *szp)
static void*
etm_hdr_write(fmd_hdl_t *hdl, etm_xport_conn_t conn, nvlist_t *evp,
- int encoding, size_t *szp)
+ int encoding, size_t *szp)
{
etm_proto_v1_ev_hdr_t *hdrp; /* for FMA_EVENT msg */
size_t hdr_sz; /* sizeof *hdrp */
@@ -1348,7 +1348,7 @@ etm_post_to_fmd(fmd_hdl_t *hdl, fmd_xprt_t *fmd_xprt, nvlist_t *evp)
static int
etm_post_to_syslog(fmd_hdl_t *hdl, uint32_t priority, uint32_t body_sz,
- uint8_t *body_buf)
+ uint8_t *body_buf)
{
char *sysmessage; /* Formatted message */
size_t formatlen; /* maximum length of sysmessage */
@@ -1633,16 +1633,16 @@ etm_iosvc_cleanup(fmd_hdl_t *fmd_hdl, etm_iosvc_t *iosvc, boolean_t clean_msg_q,
iosvc->fmd_xprt = NULL;
} /* if fmd-xprt has been opened */
- if (iosvc->send_tid != NULL) {
+ if (iosvc->send_tid != 0) {
fmd_thr_signal(fmd_hdl, iosvc->send_tid);
fmd_thr_destroy(fmd_hdl, iosvc->send_tid);
- iosvc->send_tid = NULL;
+ iosvc->send_tid = 0;
} /* if io svc send thread was created ok */
- if (iosvc->recv_tid != NULL) {
+ if (iosvc->recv_tid != 0) {
fmd_thr_signal(fmd_hdl, iosvc->recv_tid);
fmd_thr_destroy(fmd_hdl, iosvc->recv_tid);
- iosvc->recv_tid = NULL;
+ iosvc->recv_tid = 0;
} /* if root domain recv thread was created */
@@ -1763,7 +1763,8 @@ etm_iosvc_lookup(fmd_hdl_t *fmd_hdl, char *ldom_name, ds_hdl_t ds_hdl,
* remove the ckpt for the iosvc element
*/
static void
-etm_ckpt_remove(fmd_hdl_t *hdl, etm_iosvc_q_ele_t *ele) {
+etm_ckpt_remove(fmd_hdl_t *hdl, etm_iosvc_q_ele_t *ele)
+{
int err; /* temp error */
nvlist_t *evp = NULL; /* event pointer */
etm_proto_v1_ev_hdr_t *hdrp; /* hdr for FMA_EVENT */
@@ -1871,15 +1872,15 @@ etm_send_ds_msg(fmd_hdl_t *fmd_hdl, boolean_t ckpt_remove, etm_iosvc_t *iosvc,
*/
int
etm_pack_ds_msg(fmd_hdl_t *fmd_hdl, etm_iosvc_t *iosvc,
- etm_proto_v1_ev_hdr_t *ev_hdrp, size_t hdr_sz, nvlist_t *evp,
- etm_pack_msg_type_t msg_type, uint_t ckpt_opt)
+ etm_proto_v1_ev_hdr_t *ev_hdrp, size_t hdr_sz, nvlist_t *evp,
+ etm_pack_msg_type_t msg_type, uint_t ckpt_opt)
{
etm_proto_v1_ev_hdr_t *hdrp; /* for FMA_EVENT msg */
uint32_t *lenp; /* ptr to FMA event length */
size_t evsz; /* packed FMA event size */
- char *buf;
+ char *buf;
uint32_t rc; /* for return code */
- char *msg; /* body of msg to be Qed */
+ char *msg; /* body of msg to be Qed */
etm_iosvc_q_ele_t msg_ele; /* io svc msg Q ele */
etm_proto_v1_ev_hdr_t *evhdrp;
@@ -2851,7 +2852,7 @@ etm_async_q_deq(etm_async_event_ele_t *async_e)
*/
void
etm_iosvc_setup(fmd_hdl_t *fmd_hdl, etm_iosvc_t *iosvc,
- etm_async_event_ele_t *async_e)
+ etm_async_event_ele_t *async_e)
{
iosvc->ds_hdl = async_e->ds_hdl;
iosvc->cur_send_xid = 0;
@@ -2870,11 +2871,11 @@ etm_iosvc_setup(fmd_hdl_t *fmd_hdl, etm_iosvc_t *iosvc,
}
iosvc->thr_is_dying = 0;
- if (iosvc->recv_tid == NULL) {
+ if (iosvc->recv_tid == 0) {
iosvc->recv_tid = fmd_thr_create(fmd_hdl,
etm_recv_from_remote_root, iosvc);
}
- if (iosvc->send_tid == NULL) {
+ if (iosvc->send_tid == 0) {
iosvc->send_tid = fmd_thr_create(fmd_hdl,
etm_send_to_remote_root, iosvc);
}
@@ -2888,7 +2889,7 @@ etm_iosvc_setup(fmd_hdl_t *fmd_hdl, etm_iosvc_t *iosvc,
/* ARGSUSED */
static void
etm_iosvc_reg_handler(ds_hdl_t ds_hdl, ds_cb_arg_t arg, ds_ver_t *ver,
- ds_domain_hdl_t dhdl)
+ ds_domain_hdl_t dhdl)
{
etm_async_event_ele_t async_ele;
@@ -3397,15 +3398,15 @@ etm_recv_from_remote_root(void *arg)
int32_t rc; /* return value */
size_t maxlen = MAXLEN;
/* max msg len */
- char msgbuf[MAXLEN]; /* recv msg buf */
+ char msgbuf[MAXLEN]; /* recv msg buf */
size_t msg_size; /* recv msg size */
size_t hdr_sz; /* sizeof *hdrp */
size_t evsz; /* sizeof *evp */
size_t fma_event_size; /* sizeof FMA event */
- nvlist_t *evp; /* ptr to the nvlist */
+ nvlist_t *evp; /* ptr to the nvlist */
char *buf; /* ptr to the nvlist */
static uint32_t mem_alloc = 0; /* indicate if alloc mem */
- char *msg; /* ptr to alloc mem */
+ char *msg; /* ptr to alloc mem */
fmd_hdl_t *fmd_hdl = init_hdl;
@@ -4096,7 +4097,7 @@ etm_send(fmd_hdl_t *fmd_hdl, fmd_xprt_t *xp, fmd_event_t *ep, nvlist_t *nvl)
etm_pack_msg_type_t msg_type;
/* tell etm_pack_ds_msg() what to do */
etm_iosvc_t *iosvc; /* ptr to cur iosvc struct */
- char *class; /* nvlist class name */
+ char *class; /* nvlist class name */
pack_it = 1;
msg_type = FMD_XPRT_OTHER_MSG;
@@ -4197,22 +4198,22 @@ _fmd_fini(fmd_hdl_t *hdl)
etm_is_dying = 1;
- if (etm_svr_tid != NULL) {
+ if (etm_svr_tid != 0) {
fmd_thr_signal(hdl, etm_svr_tid);
fmd_thr_destroy(hdl, etm_svr_tid);
- etm_svr_tid = NULL;
+ etm_svr_tid = 0;
} /* if server thread was successfully created */
- if (etm_resp_tid != NULL) {
+ if (etm_resp_tid != 0) {
fmd_thr_signal(hdl, etm_resp_tid);
fmd_thr_destroy(hdl, etm_resp_tid);
- etm_resp_tid = NULL;
+ etm_resp_tid = 0;
} /* if responder thread was successfully created */
- if (etm_async_e_tid != NULL) {
+ if (etm_async_e_tid != 0) {
fmd_thr_signal(hdl, etm_async_e_tid);
fmd_thr_destroy(hdl, etm_async_e_tid);
- etm_async_e_tid = NULL;
+ etm_async_e_tid = 0;
} /* if async event handler thread was successfully created */
@@ -4273,16 +4274,16 @@ _fmd_fini(fmd_hdl_t *hdl)
* On root domain side, there is only one iosvc struct in use.
*/
iosvc = &io_svc;
- if (iosvc->send_tid != NULL) {
+ if (iosvc->send_tid != 0) {
fmd_thr_signal(hdl, iosvc->send_tid);
fmd_thr_destroy(hdl, iosvc->send_tid);
- iosvc->send_tid = NULL;
+ iosvc->send_tid = 0;
} /* if io svc send thread was successfully created */
- if (iosvc->recv_tid != NULL) {
+ if (iosvc->recv_tid != 0) {
fmd_thr_signal(hdl, iosvc->recv_tid);
fmd_thr_destroy(hdl, iosvc->recv_tid);
- iosvc->recv_tid = NULL;
+ iosvc->recv_tid = 0;
} /* if io svc receive thread was successfully created */
(void) pthread_mutex_lock(&iosvc->msg_q_lock);
diff --git a/usr/src/lib/fm/libldom/sparc/ldom_xmpp_client.c b/usr/src/lib/fm/libldom/sparc/ldom_xmpp_client.c
index f183b5b7f9..b12cd868e9 100644
--- a/usr/src/lib/fm/libldom/sparc/ldom_xmpp_client.c
+++ b/usr/src/lib/fm/libldom/sparc/ldom_xmpp_client.c
@@ -252,7 +252,7 @@ xmpp_connect(xmpp_conn_t *conn)
conn->tls_started = B_FALSE;
conn->parser = xmlCreatePushParserCtxt(&xml_handler, (void *) conn,
- NULL, NULL, NULL);
+ NULL, 0, NULL);
if (conn->parser == NULL) {
return (-1);
}
@@ -417,7 +417,7 @@ xmpp_client_thr(void *data)
* It should only be reset once after the ssl is opened
* in the start_tls().
*/
- (void) xmlCtxtResetPush(conn.parser, NULL, NULL, NULL,
+ (void) xmlCtxtResetPush(conn.parser, NULL, 0, NULL,
NULL);
}
xmpp_close(&conn);
diff --git a/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_walker.c b/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_walker.c
index c762e5e5c0..a767df54d6 100644
--- a/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_walker.c
+++ b/usr/src/lib/fm/topo/modules/sun4v/sun4vpi/pi_walker.c
@@ -308,7 +308,7 @@ pi_walker(pi_enum_t *pip, tnode_t *t_parent, const char *hc_name,
* by calling an appropriate creation routine for the node type.
*
* Output:
- * This routine returns MDE_WALK_NEXT, MDE_WALK_DONE or MDE_WALK_ERROR
+ * This routine returns MDE_WALK_NEXT, MDE_WALK_DONE or MDE_WALK_ERROR
* only.
*/
static int
@@ -704,7 +704,7 @@ pi_walkerlist_create(topo_mod_t *mod)
/* Initialize the uutil list structure */
walker_pool = uu_list_pool_create("pi_walker_pool",
sizeof (pi_walkernode_t), offsetof(pi_walkernode_t, walker_node),
- pi_walkerlist_compare, NULL);
+ pi_walkerlist_compare, 0);
if (walker_pool == NULL) {
(void) topo_mod_seterrno(mod, EMOD_NOMEM);
return (-1);