summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-01-20 06:04:42 -0800
committerToomas Soome <tsoome@me.com>2020-03-06 22:39:04 +0200
commita23b3b1bb4e08abaac9fb78fea486e678ce6d6de (patch)
tree9152fdaf14fec66a1e9c58d443852aa77d9cf4e2
parentab82c29b6e890d0f1241f9cd0cefda3430f46bd5 (diff)
downloadillumos-joyent-a23b3b1bb4e08abaac9fb78fea486e678ce6d6de.tar.gz
12319 ipsecah/ipsecesp: smatch errors
Reviewed by: Dan McDonald <danmcd@joyent.com> Reviewed by: Jason King <jason.king@joyent.com> Approved by: Robert Mustacchi <rm@fingolfin.org>
-rw-r--r--usr/src/uts/common/inet/ip/ipsecah.c3
-rw-r--r--usr/src/uts/common/inet/ip/ipsecesp.c3
-rw-r--r--usr/src/uts/common/inet/ip/sadb.c38
-rw-r--r--usr/src/uts/intel/ipsecah/Makefile23
-rw-r--r--usr/src/uts/intel/ipsecesp/Makefile23
-rw-r--r--usr/src/uts/sparc/ipsecah/Makefile25
-rw-r--r--usr/src/uts/sparc/ipsecesp/Makefile24
7 files changed, 22 insertions, 117 deletions
diff --git a/usr/src/uts/common/inet/ip/ipsecah.c b/usr/src/uts/common/inet/ip/ipsecah.c
index fc19d7f877..ced3696948 100644
--- a/usr/src/uts/common/inet/ip/ipsecah.c
+++ b/usr/src/uts/common/inet/ip/ipsecah.c
@@ -215,7 +215,7 @@ static int
ah_kstat_update(kstat_t *kp, int rw)
{
ah_kstats_t *ekp;
- netstackid_t stackid = (netstackid_t)(uintptr_t)kp->ks_private;
+ netstackid_t stackid;
netstack_t *ns;
ipsec_stack_t *ipss;
@@ -225,6 +225,7 @@ ah_kstat_update(kstat_t *kp, int rw)
if (rw == KSTAT_WRITE)
return (EACCES);
+ stackid = (netstackid_t)(uintptr_t)kp->ks_private;
ns = netstack_find_by_stackid(stackid);
if (ns == NULL)
return (-1);
diff --git a/usr/src/uts/common/inet/ip/ipsecesp.c b/usr/src/uts/common/inet/ip/ipsecesp.c
index b3dc7d350a..e0efbbf3ce 100644
--- a/usr/src/uts/common/inet/ip/ipsecesp.c
+++ b/usr/src/uts/common/inet/ip/ipsecesp.c
@@ -208,7 +208,7 @@ static int
esp_kstat_update(kstat_t *kp, int rw)
{
esp_kstats_t *ekp;
- netstackid_t stackid = (zoneid_t)(uintptr_t)kp->ks_private;
+ netstackid_t stackid;
netstack_t *ns;
ipsec_stack_t *ipss;
@@ -218,6 +218,7 @@ esp_kstat_update(kstat_t *kp, int rw)
if (rw == KSTAT_WRITE)
return (EACCES);
+ stackid = (zoneid_t)(uintptr_t)kp->ks_private;
ns = netstack_find_by_stackid(stackid);
if (ns == NULL)
return (-1);
diff --git a/usr/src/uts/common/inet/ip/sadb.c b/usr/src/uts/common/inet/ip/sadb.c
index 40d5078526..2792f1825c 100644
--- a/usr/src/uts/common/inet/ip/sadb.c
+++ b/usr/src/uts/common/inet/ip/sadb.c
@@ -113,8 +113,8 @@ extern uint64_t ipsacq_maxpackets;
if (((sa)->ipsa_ ## exp) == 0) \
(sa)->ipsa_ ## exp = tmp; \
else \
- (sa)->ipsa_ ## exp = \
- MIN((sa)->ipsa_ ## exp, tmp); \
+ (sa)->ipsa_ ## exp = \
+ MIN((sa)->ipsa_ ## exp, tmp); \
} \
}
@@ -154,8 +154,6 @@ sadb_sa_refrele(void *target)
static time_t
sadb_add_time(time_t base, uint64_t delta)
{
- time_t sum;
-
/*
* Clip delta to the maximum possible time_t value to
* prevent "overwrapping" back into a shorter-than-desired
@@ -163,18 +161,12 @@ sadb_add_time(time_t base, uint64_t delta)
*/
if (delta > TIME_MAX)
delta = TIME_MAX;
- /*
- * This sum may still overflow.
- */
- sum = base + delta;
- /*
- * .. so if the result is less than the base, we overflowed.
- */
- if (sum < base)
- sum = TIME_MAX;
-
- return (sum);
+ if (base > 0) {
+ if (TIME_MAX - base < delta)
+ return (TIME_MAX); /* Overflow */
+ }
+ return (base + delta);
}
/*
@@ -1695,8 +1687,7 @@ sadb_pfkey_echo(queue_t *pfkey_q, mblk_t *mp, sadb_msg_t *samsg,
mp->b_cont = mp1;
break;
default:
- if (mp != NULL)
- freemsg(mp);
+ freemsg(mp);
return;
}
@@ -2941,7 +2932,7 @@ sadb_common_add(queue_t *pfkey_q, mblk_t *mp, sadb_msg_t *samsg,
boolean_t isupdate = (newbie != NULL);
uint32_t *src_addr_ptr, *dst_addr_ptr, *isrc_addr_ptr, *idst_addr_ptr;
ipsec_stack_t *ipss = ns->netstack_ipsec;
- ip_stack_t *ipst = ns->netstack_ip;
+ ip_stack_t *ipst = ns->netstack_ip;
ipsec_alginfo_t *alg;
int rcode;
boolean_t async = B_FALSE;
@@ -4381,8 +4372,8 @@ sadb_update_lifetimes(ipsa_t *assoc, sadb_lifetime_t *hard,
if (assoc->ipsa_idletime != 0) {
assoc->ipsa_idletime = min(assoc->ipsa_idletime,
assoc->ipsa_idleuselt);
- assoc->ipsa_idleexpiretime =
- current + assoc->ipsa_idletime;
+ assoc->ipsa_idleexpiretime =
+ current + assoc->ipsa_idletime;
} else {
assoc->ipsa_idleexpiretime =
current + assoc->ipsa_idleuselt;
@@ -5445,7 +5436,7 @@ sadb_acquire(mblk_t *datamp, ip_xmit_attr_t *ixa, boolean_t need_ah,
uint32_t seq;
uint64_t unique_id = 0;
boolean_t tunnel_mode = (ixa->ixa_flags & IXAF_IPSEC_TUNNEL) != 0;
- ts_label_t *tsl;
+ ts_label_t *tsl;
netstack_t *ns = ixa->ixa_ipst->ips_netstack;
ipsec_stack_t *ipss = ns->netstack_ipsec;
ipsecesp_stack_t *espstack = ns->netstack_ipsecesp;
@@ -6097,7 +6088,8 @@ sadb_label_from_sens(sadb_sens_t *sens, uint64_t *bitmap)
return (NULL);
bsllow(&sl);
- LCLASS_SET((_bslabel_impl_t *)&sl, sens->sadb_sens_sens_level);
+ LCLASS_SET((_bslabel_impl_t *)&sl,
+ (uint16_t)sens->sadb_sens_sens_level);
bcopy(bitmap, &((_bslabel_impl_t *)&sl)->compartments,
bitmap_len);
@@ -6624,7 +6616,7 @@ ipsec_find_listen_conn(uint16_t *pptr, ipsec_selector_t *sel, ip_stack_t *ipst)
static void
ipsec_tcp_pol(ipsec_selector_t *sel, ipsec_policy_t **ppp, ip_stack_t *ipst)
{
- connf_t *connfp;
+ connf_t *connfp;
conn_t *connp;
uint32_t ports;
uint16_t *pptr = (uint16_t *)&ports;
diff --git a/usr/src/uts/intel/ipsecah/Makefile b/usr/src/uts/intel/ipsecah/Makefile
index d744c131f1..dd8485f210 100644
--- a/usr/src/uts/intel/ipsecah/Makefile
+++ b/usr/src/uts/intel/ipsecah/Makefile
@@ -42,7 +42,6 @@ UTSBASE = ../..
#
MODULE = ipsecah
OBJECTS = $(IPSECAH_OBJS:%=$(OBJS_DIR)/%)
-LINTS = $(IPSECAH_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE)
ROOTLINK = $(ROOT_STRMOD_DIR)/$(MODULE)
CONF_SRCDIR = $(UTSBASE)/common/inet/ip
@@ -56,7 +55,6 @@ include $(UTSBASE)/intel/Makefile.intel
# Define targets
#
ALL_TARGET = $(BINARY) $(SRC_CONFFILE)
-LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE)
#
@@ -64,24 +62,9 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE)
#
LDFLAGS += -dy -Ndrv/ip -Ndrv/tcp -Nmisc/kcf
-#
-# 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_SUSPICIOUS_COMPARISON
-LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV
-
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += $(CNOWARN_UNINIT)
-# needs work
-$(OBJS_DIR)/ipsecahddi.o := SMOFF += index_overflow
-$(OBJS_DIR)/ipsecah.o := SMOFF += deref_check
-$(OBJS_DIR)/sadb.o := SMOFF += signed_integer_overflow_check,deref_check,indenting,shift_to_zero
-
#
# Default build targets.
#
@@ -95,12 +78,6 @@ clean: $(CLEAN_DEPS) $(SISCLEAN_DEPS)
clobber: $(CLOBBER_DEPS) $(SISCLEAN_DEPS)
-lint: $(LINT_DEPS)
-
-modlintlib: $(MODLINTLIB_DEPS)
-
-clean.lint: $(CLEAN_LINT_DEPS)
-
install: $(INSTALL_DEPS) $(SISCHECK_DEPS)
$(ROOTLINK): $(ROOT_STRMOD_DIR) $(ROOTMODULE)
diff --git a/usr/src/uts/intel/ipsecesp/Makefile b/usr/src/uts/intel/ipsecesp/Makefile
index 713ad82d7c..3ae4a4cac1 100644
--- a/usr/src/uts/intel/ipsecesp/Makefile
+++ b/usr/src/uts/intel/ipsecesp/Makefile
@@ -26,7 +26,7 @@
# Copyright (c) 2018, Joyent, Inc.
#
-# This makefile drives the production of the ipsecesp driver
+# This makefile drives the production of the ipsecesp driver
# kernel module.
#
# intel implementation architecture dependent
@@ -42,7 +42,6 @@ UTSBASE = ../..
#
MODULE = ipsecesp
OBJECTS = $(IPSECESP_OBJS:%=$(OBJS_DIR)/%)
-LINTS = $(IPSECESP_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE)
ROOTLINK = $(ROOT_STRMOD_DIR)/$(MODULE)
CONF_SRCDIR = $(UTSBASE)/common/inet/ip
@@ -56,7 +55,6 @@ include $(UTSBASE)/intel/Makefile.intel
# Define targets
#
ALL_TARGET = $(BINARY) $(SRC_CONFFILE)
-LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE)
#
@@ -64,21 +62,8 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE)
#
LDFLAGS += -dy -Ndrv/ip -Ndrv/ipsecah -Nmisc/kcf
-#
-# 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
-
CERRWARN += $(CNOWARN_UNINIT)
-# needs work
-$(OBJS_DIR)/ipsecespddi.o := SMOFF += index_overflow
-$(OBJS_DIR)/ipsecesp.o := SMOFF += deref_check
-
#
# Default build targets.
#
@@ -92,12 +77,6 @@ clean: $(CLEAN_DEPS) $(SISCLEAN_DEPS)
clobber: $(CLOBBER_DEPS) $(SISCLEAN_DEPS)
-lint: $(LINT_DEPS)
-
-modlintlib: $(MODLINTLIB_DEPS)
-
-clean.lint: $(CLEAN_LINT_DEPS)
-
install: $(INSTALL_DEPS) $(SISCHECK_DEPS)
$(ROOTLINK): $(ROOT_STRMOD_DIR) $(ROOTMODULE)
diff --git a/usr/src/uts/sparc/ipsecah/Makefile b/usr/src/uts/sparc/ipsecah/Makefile
index 55ee48c88f..ad14fa4e5b 100644
--- a/usr/src/uts/sparc/ipsecah/Makefile
+++ b/usr/src/uts/sparc/ipsecah/Makefile
@@ -24,7 +24,7 @@
#
#
-# This makefile drives the production of the ipsecah driver
+# This makefile drives the production of the ipsecah driver
# kernel module.
#
# sparc architecture dependent
@@ -40,7 +40,6 @@ UTSBASE = ../..
#
MODULE = ipsecah
OBJECTS = $(IPSECAH_OBJS:%=$(OBJS_DIR)/%)
-LINTS = $(IPSECAH_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE)
ROOTLINK = $(ROOT_STRMOD_DIR)/$(MODULE)
CONF_SRCDIR = $(UTSBASE)/common/inet/ip
@@ -54,7 +53,6 @@ include $(UTSBASE)/sparc/Makefile.sparc
# Define targets
#
ALL_TARGET = $(BINARY) $(SRC_CONFFILE)
-LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE)
#
@@ -62,21 +60,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE)
#
LDFLAGS += -dy -Ndrv/ip -Ndrv/tcp -Nmisc/kcf
-#
-# lint pass one enforcement
-#
-CFLAGS += $(CCVERBOSE)
-
-#
-# 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_SUSPICIOUS_COMPARISON
-
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += $(CNOWARN_UNINIT)
@@ -93,12 +76,6 @@ clean: $(CLEAN_DEPS) $(SISCLEAN_DEPS)
clobber: $(CLOBBER_DEPS) $(SISCLEAN_DEPS)
-lint: $(LINT_DEPS)
-
-modlintlib: $(MODLINTLIB_DEPS)
-
-clean.lint: $(CLEAN_LINT_DEPS)
-
install: $(INSTALL_DEPS) $(SISCHECK_DEPS)
$(ROOTLINK): $(ROOT_STRMOD_DIR) $(ROOTMODULE)
diff --git a/usr/src/uts/sparc/ipsecesp/Makefile b/usr/src/uts/sparc/ipsecesp/Makefile
index 1a36e4fbc7..931dc913a2 100644
--- a/usr/src/uts/sparc/ipsecesp/Makefile
+++ b/usr/src/uts/sparc/ipsecesp/Makefile
@@ -24,7 +24,7 @@
#
#
-# This makefile drives the production of the ipsecesp driver
+# This makefile drives the production of the ipsecesp driver
# kernel module.
#
# sparc architecture dependent
@@ -40,7 +40,6 @@ UTSBASE = ../..
#
MODULE = ipsecesp
OBJECTS = $(IPSECESP_OBJS:%=$(OBJS_DIR)/%)
-LINTS = $(IPSECESP_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(ROOT_DRV_DIR)/$(MODULE)
ROOTLINK = $(ROOT_STRMOD_DIR)/$(MODULE)
CONF_SRCDIR = $(UTSBASE)/common/inet/ip
@@ -54,7 +53,6 @@ include $(UTSBASE)/sparc/Makefile.sparc
# Define targets
#
ALL_TARGET = $(BINARY) $(SRC_CONFFILE)
-LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE)
#
@@ -62,20 +60,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOTLINK) $(ROOT_CONFFILE)
#
LDFLAGS += -dy -Ndrv/ip -Ndrv/ipsecah -Nmisc/kcf
-#
-# lint pass one enforcement
-#
-CFLAGS += $(CCVERBOSE)
-
-#
-# 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
-
CERRWARN += $(CNOWARN_UNINIT)
#
@@ -91,12 +75,6 @@ clean: $(CLEAN_DEPS) $(SISCLEAN_DEPS)
clobber: $(CLOBBER_DEPS) $(SISCLEAN_DEPS)
-lint: $(LINT_DEPS)
-
-modlintlib: $(MODLINTLIB_DEPS)
-
-clean.lint: $(CLEAN_LINT_DEPS)
-
install: $(INSTALL_DEPS) $(SISCHECK_DEPS)
$(ROOTLINK): $(ROOT_STRMOD_DIR) $(ROOTMODULE)