diff options
| author | Toomas Soome <tsoome@me.com> | 2020-01-31 23:01:26 +0200 |
|---|---|---|
| committer | Toomas Soome <tsoome@me.com> | 2020-05-10 11:06:37 +0300 |
| commit | b17aa18c453380499cb628ad8e7f7536bfd9d483 (patch) | |
| tree | 5daf7f5f3b8e257dc4562349f0b5724166bfa7bc /usr | |
| parent | a5efd12c64532eac05eb5a4b6901396be06125bf (diff) | |
| download | illumos-joyent-b17aa18c453380499cb628ad8e7f7536bfd9d483.tar.gz | |
12653 vnet: smatch and NULL pointer errors
Reviewed by: C Fraire <cfraire@me.com>
Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Diffstat (limited to 'usr')
| -rw-r--r-- | usr/src/uts/sun4v/io/vnet.c | 2 | ||||
| -rw-r--r-- | usr/src/uts/sun4v/io/vnet_gen.c | 59 | ||||
| -rw-r--r-- | usr/src/uts/sun4v/sys/vnet.h | 20 | ||||
| -rw-r--r-- | usr/src/uts/sun4v/vnet/Makefile | 23 |
4 files changed, 42 insertions, 62 deletions
diff --git a/usr/src/uts/sun4v/io/vnet.c b/usr/src/uts/sun4v/io/vnet.c index 96fb04175d..8abeaf911b 100644 --- a/usr/src/uts/sun4v/io/vnet.c +++ b/usr/src/uts/sun4v/io/vnet.c @@ -2481,7 +2481,7 @@ vnet_rx_ring_stat(mac_ring_driver_t rdriver, uint_t stat, uint64_t *val) macp = &vresp->macreg; cbp = macp->m_callbacks; - cbp->mc_getstat(macp->m_driver, stat, val); + (void) cbp->mc_getstat(macp->m_driver, stat, val); return (0); } diff --git a/usr/src/uts/sun4v/io/vnet_gen.c b/usr/src/uts/sun4v/io/vnet_gen.c index c872b641c6..ae89f44a33 100644 --- a/usr/src/uts/sun4v/io/vnet_gen.c +++ b/usr/src/uts/sun4v/io/vnet_gen.c @@ -297,7 +297,7 @@ static char vgen_linkprop_propname[] = "linkprop"; * 1.3 VLAN and HybridIO support. * 1.4 Jumbo Frame support. * 1.5 Link State Notification support with optional support - * for Physical Link information. + * for Physical Link information. * 1.6 Support for RxDringData mode. */ static vgen_ver_t vgen_versions[VGEN_NUM_VER] = { {1, 6} }; @@ -697,7 +697,7 @@ vgen_tx(void *arg, mblk_t *mp) */ static mblk_t * vgen_vlan_frame_fixtag(vgen_port_t *portp, mblk_t *mp, boolean_t is_tagged, - uint16_t vid) + uint16_t vid) { vgen_t *vgenp; boolean_t dst_tagged; @@ -781,8 +781,8 @@ vgen_portsend(vgen_port_t *portp, mblk_t *mp) vgen_ldc_t *ldcp; int status; int rv = VGEN_SUCCESS; - vgen_t *vgenp = portp->vgenp; - vnet_t *vnetp = vgenp->vnetp; + vgen_t *vgenp; + vnet_t *vnetp; boolean_t is_tagged; boolean_t dec_refcnt = B_FALSE; uint16_t vlan_id; @@ -792,6 +792,9 @@ vgen_portsend(vgen_port_t *portp, mblk_t *mp) return (VGEN_FAILURE); } + vgenp = portp->vgenp; + vnetp = vgenp->vnetp; + if (portp->use_vsw_port) { (void) atomic_inc_32(&vgenp->vsw_port_refcnt); portp = portp->vgenp->vsw_portp; @@ -1396,8 +1399,8 @@ vgen_readmd_exit: */ static void vgen_vlan_read_ids(void *arg, int type, md_t *mdp, mde_cookie_t node, - uint16_t *pvidp, uint16_t **vidspp, uint16_t *nvidsp, - uint16_t *default_idp) + uint16_t *pvidp, uint16_t **vidspp, uint16_t *nvidsp, + uint16_t *default_idp) { vgen_t *vgenp; vnet_t *vnetp; @@ -1686,7 +1689,7 @@ vgen_mtu_read(vgen_t *vgenp, md_t *mdp, mde_cookie_t node, uint32_t *mtu) static void vgen_linkprop_read(vgen_t *vgenp, md_t *mdp, mde_cookie_t node, - boolean_t *pls) + boolean_t *pls) { int rv; uint64_t val; @@ -1714,8 +1717,8 @@ vgen_mdeg_reg(vgen_t *vgenp) mdeg_node_spec_t *parentp; uint_t templatesz; int rv; - mdeg_handle_t dev_hdl = NULL; - mdeg_handle_t port_hdl = NULL; + mdeg_handle_t dev_hdl = 0; + mdeg_handle_t port_hdl = 0; templatesz = sizeof (vgen_prop_template); pspecp = kmem_zalloc(templatesz, KM_NOSLEEP); @@ -1767,7 +1770,7 @@ vgen_mdeg_reg(vgen_t *vgenp) return (DDI_SUCCESS); mdeg_reg_fail: - if (dev_hdl != NULL) { + if (dev_hdl != 0) { (void) mdeg_unregister(dev_hdl); } KMEM_FREE(parentp); @@ -1780,13 +1783,13 @@ mdeg_reg_fail: static void vgen_mdeg_unreg(vgen_t *vgenp) { - if (vgenp->mdeg_dev_hdl != NULL) { + if (vgenp->mdeg_dev_hdl != 0) { (void) mdeg_unregister(vgenp->mdeg_dev_hdl); - vgenp->mdeg_dev_hdl = NULL; + vgenp->mdeg_dev_hdl = 0; } - if (vgenp->mdeg_port_hdl != NULL) { + if (vgenp->mdeg_port_hdl != 0) { (void) mdeg_unregister(vgenp->mdeg_port_hdl); - vgenp->mdeg_port_hdl = NULL; + vgenp->mdeg_port_hdl = 0; } if (vgenp->mdeg_parentp != NULL) { @@ -1803,7 +1806,7 @@ vgen_mdeg_port_cb(void *cb_argp, mdeg_result_t *resp) { int idx; int vsw_idx = -1; - uint64_t val; + uint64_t val; vgen_t *vgenp; if ((resp == NULL) || (cb_argp == NULL)) { @@ -2108,7 +2111,7 @@ vgen_add_port(vgen_t *vgenp, md_t *mdp, mde_cookie_t mdex) /* read properties of the port from its md node */ static int vgen_port_read_props(vgen_port_t *portp, vgen_t *vgenp, md_t *mdp, - mde_cookie_t mdex) + mde_cookie_t mdex) { uint64_t port_num; uint64_t *ldc_ids; @@ -2362,7 +2365,7 @@ vgen_port_detach_mdeg(vgen_port_t *portp) static int vgen_update_port(vgen_t *vgenp, md_t *curr_mdp, mde_cookie_t curr_mdex, - md_t *prev_mdp, mde_cookie_t prev_mdex) + md_t *prev_mdp, mde_cookie_t prev_mdex) { uint64_t cport_num; uint64_t pport_num; @@ -2454,10 +2457,10 @@ vgen_port_stat(vgen_port_t *portp, uint_t stat) static int vgen_ldc_attach(vgen_port_t *portp, uint64_t ldc_id) { - vgen_t *vgenp; - vgen_ldc_t *ldcp; - ldc_attr_t attr; - int status; + vgen_t *vgenp; + vgen_ldc_t *ldcp; + ldc_attr_t attr; + int status; ldc_status_t istatus; char kname[MAXNAMELEN]; int instance; @@ -2567,7 +2570,7 @@ static void vgen_ldc_detach(vgen_ldc_t *ldcp) { vgen_port_t *portp; - vgen_t *vgenp; + vgen_t *vgenp; ASSERT(ldcp != NULL); @@ -3000,7 +3003,7 @@ vgen_ldc_cb(uint64_t event, caddr_t arg) _NOTE(ARGUNUSED(event)) vgen_ldc_t *ldcp; vgen_t *vgenp; - ldc_status_t istatus; + ldc_status_t istatus; vgen_stats_t *statsp; uint_t ret = LDC_SUCCESS; @@ -3012,7 +3015,7 @@ vgen_ldc_cb(uint64_t event, caddr_t arg) mutex_enter(&ldcp->cblock); statsp->callbacks++; - if ((ldcp->ldc_status == LDC_INIT) || (ldcp->ldc_handle == NULL)) { + if ((ldcp->ldc_status == LDC_INIT) || (ldcp->ldc_handle == 0)) { DWARN(vgenp, ldcp, "status(%d) is LDC_INIT\n", ldcp->ldc_status); mutex_exit(&ldcp->cblock); @@ -3111,8 +3114,8 @@ vgen_handle_evt_read(vgen_ldc_t *ldcp, vgen_caller_t caller) size_t msglen; vgen_t *vgenp = LDC_TO_VGEN(ldcp); vio_msg_tag_t *tagp; - ldc_status_t istatus; - boolean_t has_data; + ldc_status_t istatus; + boolean_t has_data; DBG1(vgenp, ldcp, "enter\n"); @@ -4227,7 +4230,7 @@ vgen_handshake_done(vgen_ldc_t *ldcp) { vgen_t *vgenp = LDC_TO_VGEN(ldcp); uint32_t hphase = ldcp->hphase; - int status = 0; + int status = 0; switch (hphase) { @@ -5724,7 +5727,7 @@ vgen_check_sid(vgen_ldc_t *ldcp, vio_msg_tag_t *tagp) */ static void vgen_init_dring_reg_msg(vgen_ldc_t *ldcp, vio_dring_reg_msg_t *msg, - uint8_t option) + uint8_t option) { vio_msg_tag_t *tagp; diff --git a/usr/src/uts/sun4v/sys/vnet.h b/usr/src/uts/sun4v/sys/vnet.h index 81b958fedf..04d2df006a 100644 --- a/usr/src/uts/sun4v/sys/vnet.h +++ b/usr/src/uts/sun4v/sys/vnet.h @@ -90,16 +90,16 @@ typedef struct vnet_hio_kstats { kstat_named_t oerrors; /* required by kstat for MIB II objects(RFC 1213) */ - kstat_named_t rbytes; /* MIB - ifInOctets */ + kstat_named_t rbytes; /* MIB - ifInOctets */ kstat_named_t rbytes64; - kstat_named_t obytes; /* MIB - ifOutOctets */ + kstat_named_t obytes; /* MIB - ifOutOctets */ kstat_named_t obytes64; - kstat_named_t multircv; /* MIB - ifInNUcastPkts */ - kstat_named_t multixmt; /* MIB - ifOutNUcastPkts */ + kstat_named_t multircv; /* MIB - ifInNUcastPkts */ + kstat_named_t multixmt; /* MIB - ifOutNUcastPkts */ kstat_named_t brdcstrcv; /* MIB - ifInNUcastPkts */ kstat_named_t brdcstxmt; /* MIB - ifOutNUcastPkts */ - kstat_named_t norcvbuf; /* MIB - ifInDiscards */ - kstat_named_t noxmtbuf; /* MIB - ifOutDiscards */ + kstat_named_t norcvbuf; /* MIB - ifInDiscards */ + kstat_named_t noxmtbuf; /* MIB - ifOutDiscards */ } vnet_hio_kstats_t; typedef struct vnet_tx_ring_stats { @@ -348,10 +348,10 @@ enum { DBG_LEVEL1 = 0x01, DBG_LEVEL2 = 0x02, DBG_WARN = 0x04, #else -#define DBG1(...) if (0) do { } while (0) -#define DBG2(...) if (0) do { } while (0) -#define DWARN(...) if (0) do { } while (0) -#define DERR(...) if (0) do { } while (0) +#define DBG1(...) +#define DBG2(...) +#define DWARN(...) +#define DERR(...) #endif diff --git a/usr/src/uts/sun4v/vnet/Makefile b/usr/src/uts/sun4v/vnet/Makefile index 858c2c58da..21e1ea2b9c 100644 --- a/usr/src/uts/sun4v/vnet/Makefile +++ b/usr/src/uts/sun4v/vnet/Makefile @@ -42,7 +42,6 @@ UTSBASE = ../.. # MODULE = vnet OBJECTS = $(VNET_OBJS:%=$(OBJS_DIR)/%) -LINTS = $(VNET_OBJS:%.o=$(LINTS_DIR)/%.ln) ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE) # @@ -61,13 +60,8 @@ CLEANFILES += $(MODSTUBS_O) # Define targets # ALL_TARGET = $(BINARY) -LINT_TARGET = $(MODULE).lint INSTALL_TARGET = $(BINARY) $(ROOTMODULE) -# -# lint pass one enforcement -# -CFLAGS += $(CCVERBOSE) CFLAGS += -DVGEN_HANDLE_LOST_PKTS # @@ -75,17 +69,6 @@ CFLAGS += -DVGEN_HANDLE_LOST_PKTS # LDFLAGS += -dy -N misc/mac -N drv/ip -N misc/ldc -N misc/platsvc -# -# For now, disable these lint checks; maintainers should endeavor -# to investigate and remove these for maximum lint coverage. -# Please do not carry these forward to new Makefiles. -# -LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN -LINTTAGS += -erroff=E_PTRDIFF_OVERFLOW -LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV -LINTTAGS += -erroff=E_STATIC_UNUSED -LINTTAGS += -erroff=E_SUSPICIOUS_COMPARISON - CERRWARN += -_gcc=-Wno-type-limits CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-unused-label @@ -107,12 +90,6 @@ clean: $(CLEAN_DEPS) clobber: $(CLOBBER_DEPS) -lint: $(LINT_DEPS) - -modlintlib: $(MODLINTLIB_DEPS) - -clean.lint: $(CLEAN_LINT_DEPS) - install: $(INSTALL_DEPS) # |
