diff options
author | John Levon <john.levon@joyent.com> | 2019-08-15 02:34:17 -0700 |
---|---|---|
committer | John Levon <john.levon@joyent.com> | 2019-08-21 00:48:36 -0700 |
commit | 44bf619d328827ce5eca6833fcd5c69f1592e578 (patch) | |
tree | 9ad4659713906427323f35a72759a16fbc94762d | |
parent | a99cb9618990662acbd3bab1b4a5b05a6ca62556 (diff) | |
download | illumos-joyent-44bf619d328827ce5eca6833fcd5c69f1592e578.tar.gz |
10703 smatch unreachable code checking needs reworking
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Approved by: Dan McDonald <danmcd@joyent.com>
48 files changed, 110 insertions, 177 deletions
diff --git a/usr/src/Makefile.smatch b/usr/src/Makefile.smatch index 4f20c0497b..19cbadf184 100644 --- a/usr/src/Makefile.smatch +++ b/usr/src/Makefile.smatch @@ -16,7 +16,7 @@ # simply too much legacy). # -SMATCH_ARGS = --disable=uninitialized,check_check_deref,unreachable +SMATCH_ARGS = --disable=uninitialized,check_check_deref # VLAs are OK by us SMATCH_ARGS += -Wno-vla diff --git a/usr/src/cmd/ctfmerge/ctfmerge.c b/usr/src/cmd/ctfmerge/ctfmerge.c index 2da162a99b..23328fefc2 100644 --- a/usr/src/cmd/ctfmerge/ctfmerge.c +++ b/usr/src/cmd/ctfmerge/ctfmerge.c @@ -10,7 +10,7 @@ */ /* - * Copyright (c) 2019, Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ /* @@ -47,7 +47,7 @@ static uint_t g_nctf; #define CTFMERGE_DEFAULT_NTHREADS 8 #define CTFMERGE_ALTEXEC "CTFMERGE_ALTEXEC" -static void +static void __attribute__((__noreturn__)) ctfmerge_fatal(const char *fmt, ...) { va_list ap; diff --git a/usr/src/cmd/cxgbetool/cxgbetool.c b/usr/src/cmd/cxgbetool/cxgbetool.c index d45e843202..ff5c01427a 100644 --- a/usr/src/cmd/cxgbetool/cxgbetool.c +++ b/usr/src/cmd/cxgbetool/cxgbetool.c @@ -13,6 +13,10 @@ * Copyright (c) 2018 by Chelsio Communications, Inc. */ +/* + * Copyright 2019 Joyent, Inc. + */ + #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -85,7 +89,7 @@ static void usage(FILE *fp) exit(fp == stderr ? 1 : 0); } -static void +__NORETURN static void err(int code, const char *fmt, ...) { va_list ap; diff --git a/usr/src/cmd/fm/modules/common/ext-event-transport/fmevt_outbound.c b/usr/src/cmd/fm/modules/common/ext-event-transport/fmevt_outbound.c index 46bc458072..eb07ef8601 100644 --- a/usr/src/cmd/fm/modules/common/ext-event-transport/fmevt_outbound.c +++ b/usr/src/cmd/fm/modules/common/ext-event-transport/fmevt_outbound.c @@ -23,6 +23,10 @@ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright 2019 Joyent, Inc. + */ + #include <sys/types.h> #include <strings.h> #include <fm/fmd_api.h> @@ -112,7 +116,6 @@ fmevt_init_outbound(fmd_hdl_t *hdl) EVCH_CREAT | EVCH_HOLD_PEND_INDEF) != 0) { fmd_hdl_abort(hdl, "Unable to bind channel %s", channel_name); - return; } channel_depth = fmd_prop_get_int32(hdl, "outbound_channel_depth"); diff --git a/usr/src/cmd/fs.d/reparsed/reparsed.c b/usr/src/cmd/fs.d/reparsed/reparsed.c index 0b1532dc40..b17a9fece5 100644 --- a/usr/src/cmd/fs.d/reparsed/reparsed.c +++ b/usr/src/cmd/fs.d/reparsed/reparsed.c @@ -24,7 +24,7 @@ */ /* - * Copyright (c) 2018, Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ /* @@ -187,7 +187,7 @@ main(int argc, char *argv[]) return (start_reparsed_svcs()); } -static void +__NORETURN static void reparsed_door_call_error(int error, int buflen) { reparsed_door_res_t rpd_res; @@ -354,10 +354,6 @@ start_reparsed_svcs() /* * Wait for incoming calls */ - /*CONSTCOND*/ while (1) (void) pause(); - - syslog(LOG_ERR, "Door server exited"); - return (10); } diff --git a/usr/src/cmd/mdb/common/mdb/mdb_main.c b/usr/src/cmd/mdb/common/mdb/mdb_main.c index 7feec28a40..cedb3e992d 100644 --- a/usr/src/cmd/mdb/common/mdb/mdb_main.c +++ b/usr/src/cmd/mdb/common/mdb/mdb_main.c @@ -25,7 +25,7 @@ */ /* - * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright 2019 Joyent, Inc. */ #include <sys/types.h> @@ -1098,7 +1098,6 @@ tcreate: terminate((status == MDB_ERR_QUIT || status == 0) ? (eflag != NULL && mdb.m_lastret != 0 ? 1 : 0) : 1); /*NOTREACHED*/ - return (0); reexec: if ((p = strrchr(execname, '/')) == NULL) diff --git a/usr/src/cmd/od/od.c b/usr/src/cmd/od/od.c index 30e140ba96..869413d9d4 100644 --- a/usr/src/cmd/od/od.c +++ b/usr/src/cmd/od/od.c @@ -14,6 +14,10 @@ */ /* + * Copyright 2019 Joyent, Inc. + */ + +/* * od - octal dump. Not really just octal anymore; read the POSIX * specification for it -- its more complex than you think! * @@ -533,7 +537,6 @@ do_type_string(char *typestr) default: errx(1, _("unrecognized type string character: %c"), *typestr); - exit(1); } } } diff --git a/usr/src/cmd/sgs/libld/common/map_core.c b/usr/src/cmd/sgs/libld/common/map_core.c index 8cc1753722..9ab1dd71a5 100644 --- a/usr/src/cmd/sgs/libld/common/map_core.c +++ b/usr/src/cmd/sgs/libld/common/map_core.c @@ -24,6 +24,8 @@ * All Rights Reserved * * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * + * Copyright 2019 Joyent, Inc. */ /* @@ -2073,10 +2075,6 @@ ld_map_gettoken(Mapfile *mf, int flags, ld_map_tkval_t *tkv) return (tok); } } - - /*NOTREACHED*/ - assert(0); - return (TK_ERROR); } /* diff --git a/usr/src/cmd/sgs/libld/common/map_support.c b/usr/src/cmd/sgs/libld/common/map_support.c index 683cb59102..8e69b6052e 100644 --- a/usr/src/cmd/sgs/libld/common/map_support.c +++ b/usr/src/cmd/sgs/libld/common/map_support.c @@ -28,7 +28,7 @@ */ /* - * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright 2019 Joyent, Inc. */ /* @@ -84,8 +84,6 @@ ld_map_kwfind(const char *name, void *array, size_t name_offset, } /*NOTREACHED*/ - assert(0); - return (NULL); } #endif @@ -199,7 +197,7 @@ ld_map_cap_set_ovflag(Mapfile *mf, Word type) * override flag. */ static ofl_flag_t override_flag[CA_SUNW_NUM] = { - 0, /* CA_SUNW_NULL */ + 0, /* CA_SUNW_NULL */ FLG_OF1_OVHWCAP1, /* CA_SUNW_HW_1 */ FLG_OF1_OVSFCAP1, /* CA_SUNW_SF_1 */ FLG_OF1_OVHWCAP2, /* CA_SUNW_HW_2 */ diff --git a/usr/src/cmd/sgs/libld/common/map_v2.c b/usr/src/cmd/sgs/libld/common/map_v2.c index 26252f4d73..eb397838af 100644 --- a/usr/src/cmd/sgs/libld/common/map_v2.c +++ b/usr/src/cmd/sgs/libld/common/map_v2.c @@ -25,6 +25,10 @@ */ /* + * Copyright 2019 Joyent, Inc. + */ + +/* * Map file parsing, Version 2 syntax (solaris). */ #include <stdio.h> @@ -3318,8 +3322,4 @@ ld_map_parse_v2(Mapfile *mf) return (FALSE); } } - - /*NOTREACHED*/ - assert(0); - return (FALSE); } diff --git a/usr/src/cmd/svc/configd/client.c b/usr/src/cmd/svc/configd/client.c index 13c0140354..9f46d0dff8 100644 --- a/usr/src/cmd/svc/configd/client.c +++ b/usr/src/cmd/svc/configd/client.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2015 RackTop Systems. + * Copyright 2019 Joyent, Inc. */ /* @@ -1988,7 +1989,6 @@ start_audit_session(repcache_client_t *cp) case EFAULT: default: bad_error("door_ucred", errno); - return; } } if (adt_start_session(&session, NULL, 0) != 0) { diff --git a/usr/src/cmd/svc/startd/graph.c b/usr/src/cmd/svc/startd/graph.c index 2bd8bcb850..f63be7f941 100644 --- a/usr/src/cmd/svc/startd/graph.c +++ b/usr/src/cmd/svc/startd/graph.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2018 Joyent, Inc. + * Copyright 2019 Joyent, Inc. * Copyright (c) 2015, Syneto S.R.L. All rights reserved. * Copyright 2016 Toomas Soome <tsoome@me.com> * Copyright 2016 RackTop Systems. @@ -5817,14 +5817,6 @@ graph_event_thread(void *unused) MUTEX_UNLOCK(&gu->gu_lock); } - - /* - * Unreachable for now -- there's currently no graceful cleanup - * called on exit(). - */ - MUTEX_UNLOCK(&gu->gu_lock); - scf_handle_destroy(h); - return (NULL); } static void @@ -6190,15 +6182,6 @@ graph_thread(void *arg) (void) pthread_cond_wait(&gu->gu_freeze_cv, &gu->gu_freeze_lock); } - - /* - * Unreachable for now -- there's currently no graceful cleanup - * called on exit(). - */ - (void) pthread_mutex_unlock(&gu->gu_freeze_lock); - scf_handle_destroy(h); - - return (NULL); } diff --git a/usr/src/cmd/svc/startd/restarter.c b/usr/src/cmd/svc/startd/restarter.c index 7ed65aab6a..516004c894 100644 --- a/usr/src/cmd/svc/startd/restarter.c +++ b/usr/src/cmd/svc/startd/restarter.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2018 Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ /* @@ -2090,14 +2090,6 @@ nolookup: MUTEX_LOCK(&ru->restarter_update_lock); } } - - /* - * Unreachable for now -- there's currently no graceful cleanup - * called on exit(). - */ - (void) scf_handle_unbind(h); - scf_handle_destroy(h); - return (NULL); } static restarter_inst_t * diff --git a/usr/src/cmd/svc/svcprop/svcprop.c b/usr/src/cmd/svc/svcprop/svcprop.c index 6b6f1663f1..fff80364cb 100644 --- a/usr/src/cmd/svc/svcprop/svcprop.c +++ b/usr/src/cmd/svc/svcprop/svcprop.c @@ -25,7 +25,7 @@ */ /* - * Copyright (c) 2011, Joyent, Inc. All rights reserved. + * Copyright 2019 Joyent, Inc. */ /* @@ -630,8 +630,6 @@ process_pg(scf_propertygroup_t *pg) "has too many components for property " "group `%s'.\n"), spn->spn_comp1, spn->spn_comp2, buf); - - free(buf); } if (scf_pg_get_property(pg, spn->spn_comp1, prop) == 0) { diff --git a/usr/src/cmd/ul/Makefile b/usr/src/cmd/ul/Makefile index dfc14b2124..74cc16cd8a 100644 --- a/usr/src/cmd/ul/Makefile +++ b/usr/src/cmd/ul/Makefile @@ -20,10 +20,10 @@ # CDDL HEADER END # # -#ident "%Z%%M% %I% %E% SMI" -# # Copyright (c) 1989 by Sun Microsystems, Inc. # +# Copyright 2019 Joyent, Inc. +# PROG= ul @@ -31,14 +31,15 @@ include ../Makefile.cmd LDLIBS += -lcurses +# false positive +SMOFF += unreachable + .KEEP_STATE: -all: $(PROG) +all: $(PROG) install: all $(ROOTPROG) clean: -lint: lint_PROG - include ../Makefile.targ diff --git a/usr/src/cmd/zonecfg/Makefile b/usr/src/cmd/zonecfg/Makefile index be3e325ba6..c5d042f48f 100644 --- a/usr/src/cmd/zonecfg/Makefile +++ b/usr/src/cmd/zonecfg/Makefile @@ -22,7 +22,8 @@ # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright (c) 2018, Joyent, Inc. +# Copyright 2019 Joyent, Inc. +# PROG= zonecfg OBJS= zonecfg.o zonecfg_lex.o zonecfg_grammar.tab.o @@ -49,6 +50,9 @@ CERRWARN += -_gcc=-Wno-implicit-function-declaration SMOFF += all_func_returns +# false positive +zonecfg_lex.o := SMOFF += free + CLOBBERFILES += $(PROG).ln .KEEP_STATE: diff --git a/usr/src/lib/brand/shared/brand/Makefile.com b/usr/src/lib/brand/shared/brand/Makefile.com index 8d58c993d8..0d5afe31f6 100644 --- a/usr/src/lib/brand/shared/brand/Makefile.com +++ b/usr/src/lib/brand/shared/brand/Makefile.com @@ -23,7 +23,7 @@ # # Copyright 2013 Nexenta Systems, Inc. All rights reserved. # -# Copyright (c) 2019, Joyent, Inc. +# Copyright 2019 Joyent, Inc. # COBJS = brand_util.o @@ -55,6 +55,9 @@ CPPFLAGS += -D_REENTRANT -U_ASM -I. -I../sys CFLAGS += $(CCVERBOSE) ASFLAGS = -P $(ASFLAGS_$(CURTYPE)) -D_ASM -I. -I../sys +# intentional code after abort() +SMOFF += unreachable + .KEEP_STATE: # @@ -67,8 +70,6 @@ ASFLAGS = -P $(ASFLAGS_$(CURTYPE)) -D_ASM -I. -I../sys # all: pics .WAIT $$(PICS) -lint: lintcheck - $(OBJECTS:%=pics/%): $(OFFSETS_H) $(OFFSETS_H): $(OFFSETS_SRC) diff --git a/usr/src/lib/crt/Makefile.com b/usr/src/lib/crt/Makefile.com index 9ae8be2310..8415cf0cbe 100644 --- a/usr/src/lib/crt/Makefile.com +++ b/usr/src/lib/crt/Makefile.com @@ -22,6 +22,8 @@ # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# Copyright 2019 Joyent, Inc. +# CRTI = crti.o CRTN = crtn.o @@ -51,10 +53,12 @@ $(INTEL_BLD)ROOTOBJECTS64 += $(ROOTLIB64)/gcrt1.o ASFLAGS += -P -D__STDC__ -D_ASM -DPIC $(AS_PICFLAGS) values-xpg6.o := CPPFLAGS += -I$(SRC)/lib/libc/inc -values-xpg6.lint := CPPFLAGS += -I$(SRC)/lib/libc/inc $(COMMON_CRT) $(VALUES) := CFLAGS += $(C_PICFLAGS) $(COMMON_CRT) $(VALUES) := CFLAGS64 += $(C_PICFLAGS64) +# intentional double exit +SMOFF += unreachable + .KEEP_STATE: all: $(OBJECTS) @@ -62,10 +66,6 @@ all: $(OBJECTS) clean clobber: $(RM) $(OBJECTS) -%.lint: ../common/%.c - $(LINT.c) $(LINTCHECKFLAGS) $< - -lint: $(VALUES:%.o=%.lint) $(COMMON_CRT:%.o=%.lint) $(CRT1): $(COMMON_CRT) $(MACH_CRT) $(LD) -r $(MACH_CRT) $(COMMON_CRT) -o $(CRT1) diff --git a/usr/src/lib/fm/libfmd_snmp/common/debug_subr.c b/usr/src/lib/fm/libfmd_snmp/common/debug_subr.c index 6b31fd10bf..cfce01c339 100644 --- a/usr/src/lib/fm/libfmd_snmp/common/debug_subr.c +++ b/usr/src/lib/fm/libfmd_snmp/common/debug_subr.c @@ -24,6 +24,10 @@ * Use is subject to license terms. */ +/* + * Copyright 2019 Joyent, Inc. + */ + #include <net-snmp/net-snmp-config.h> #include <net-snmp/net-snmp-includes.h> #include <net-snmp/agent/net-snmp-agent-includes.h> @@ -35,7 +39,6 @@ sunFm_vpanic(const char *format, va_list ap) (void) snmp_vlog(LOG_ERR, format, ap); #ifdef DEBUG abort(); - exit(1); #endif } diff --git a/usr/src/lib/scsi/libscsi/common/scsi_subr.c b/usr/src/lib/scsi/libscsi/common/scsi_subr.c index 712a9f88c5..cb02cd22ee 100644 --- a/usr/src/lib/scsi/libscsi/common/scsi_subr.c +++ b/usr/src/lib/scsi/libscsi/common/scsi_subr.c @@ -23,6 +23,10 @@ * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright 2019 Joyent, Inc. + */ + #include <sys/types.h> #include <sys/scsi/generic/commands.h> #include <sys/scsi/impl/spc3_types.h> @@ -56,10 +60,7 @@ libscsi_assert(const char *expr, const char *file, int line) (void) write(STDERR_FILENO, msg, strlen(msg)); abort(); - _exit(1); - /*NOTREACHED*/ - return (0); } int diff --git a/usr/src/lib/scsi/libses/Makefile.defs b/usr/src/lib/scsi/libses/Makefile.defs index a8b5669944..0c31d9af9f 100644 --- a/usr/src/lib/scsi/libses/Makefile.defs +++ b/usr/src/lib/scsi/libses/Makefile.defs @@ -22,7 +22,8 @@ # # Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # -# Copyright (c) 2018, Joyent, Inc. +# Copyright 2019 Joyent, Inc. +# SRCS = $(OBJECTS:%.o=../common/%.c) CSTD = $(CSTD_GNU99) @@ -32,7 +33,6 @@ CFLAGS += $(CCVERBOSE) CERRWARN += -_gcc=-Wno-type-limits CERRWARN += $(CNOWARN_UNINIT) -CERRWARN += -_gcc=-Wno-unused-label SMOFF += all_func_returns diff --git a/usr/src/lib/scsi/libses/common/ses_subr.c b/usr/src/lib/scsi/libses/common/ses_subr.c index aa1013e678..e2f5dd2d9f 100644 --- a/usr/src/lib/scsi/libses/common/ses_subr.c +++ b/usr/src/lib/scsi/libses/common/ses_subr.c @@ -24,7 +24,9 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright 2019 Joyent, Inc. + */ #include <scsi/libses.h> #include "ses_impl.h" @@ -54,9 +56,7 @@ ses_vpanic(const char *fmt, va_list ap) (void) write(STDERR_FILENO, msg, strlen(msg)); -abort: abort(); - _exit(1); } /*PRINTFLIKE1*/ diff --git a/usr/src/lib/scsi/libsmp/common/smp_subr.c b/usr/src/lib/scsi/libsmp/common/smp_subr.c index f332c3c7bf..c2e0f66cbc 100644 --- a/usr/src/lib/scsi/libsmp/common/smp_subr.c +++ b/usr/src/lib/scsi/libsmp/common/smp_subr.c @@ -23,6 +23,10 @@ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. */ +/* + * Copyright 2019 Joyent, Inc. + */ + #include <sys/types.h> #include <stddef.h> @@ -61,10 +65,7 @@ smp_assert(const char *expr, const char *file, int line) (void) write(STDERR_FILENO, msg, strlen(msg)); abort(); - _exit(1); - /*NOTREACHED*/ - return (0); } int diff --git a/usr/src/test/libc-tests/tests/Makefile b/usr/src/test/libc-tests/tests/Makefile index d22d33f613..f746498b0c 100644 --- a/usr/src/test/libc-tests/tests/Makefile +++ b/usr/src/test/libc-tests/tests/Makefile @@ -12,7 +12,7 @@ # # Copyright (c) 2012 by Delphix. All rights reserved. # Copyright 2015 Garrett D'Amore <garrett@damore.org> -# Copyright (c) 2018, Joyent, Inc. +# Copyright 2019 Joyent, Inc. # SUBDIRS = \ @@ -58,7 +58,7 @@ SCRIPTS = \ CPPFLAGS += -D_REENTRANT # needs work -SMOFF += all_func_returns,snprintf_overflow +SMOFF += all_func_returns,snprintf_overflow,unreachable PROGS32 = $(PROGS:%=%.32) PROGS64 = \ diff --git a/usr/src/test/libc-tests/tests/c11_threads.c b/usr/src/test/libc-tests/tests/c11_threads.c index 2f96bcbd89..4504a9c262 100644 --- a/usr/src/test/libc-tests/tests/c11_threads.c +++ b/usr/src/test/libc-tests/tests/c11_threads.c @@ -10,7 +10,7 @@ */ /* - * Copyright 2017 Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ /* @@ -172,7 +172,6 @@ static int cthr_test_detach_thr0(void *arg) { thrd_exit(23); - abort(); } static int diff --git a/usr/src/test/os-tests/tests/file-locking/runtests.c b/usr/src/test/os-tests/tests/file-locking/runtests.c index 0d92d7e638..bac97c7398 100644 --- a/usr/src/test/os-tests/tests/file-locking/runtests.c +++ b/usr/src/test/os-tests/tests/file-locking/runtests.c @@ -10,7 +10,7 @@ */ /* - * Copyright 2018 Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ /* @@ -327,7 +327,6 @@ flock_wait(pid_t pid) return (1); } else { abort(); - return (1); } } diff --git a/usr/src/test/os-tests/tests/file-locking/util.c b/usr/src/test/os-tests/tests/file-locking/util.c index b178e8a405..3133d4ac47 100644 --- a/usr/src/test/os-tests/tests/file-locking/util.c +++ b/usr/src/test/os-tests/tests/file-locking/util.c @@ -10,7 +10,7 @@ */ /* - * Copyright 2018 Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ /* @@ -101,7 +101,6 @@ flock_styleenum(char *stylestr) return (LSTYLE_FLOCK); } else { errx(EXIT_FAILURE, BAD_LOCK_MESSAGE); - return (LSTYLE_LAST); } } @@ -118,7 +117,6 @@ flock_stylestr(lock_style_t style) return ("flock"); default: abort(); - return ("<unreachable>"); } } @@ -135,7 +133,6 @@ flock_stylename(lock_style_t style) return ("flock(3C)"); default: abort(); - return ("<unreachable>"); } } @@ -178,6 +175,5 @@ flock_cmdname(int cmd) #endif default: abort(); - return ("<unreachable>"); } } diff --git a/usr/src/test/os-tests/tests/sockfs/conn.c b/usr/src/test/os-tests/tests/sockfs/conn.c index 063d5bedba..9375966b74 100644 --- a/usr/src/test/os-tests/tests/sockfs/conn.c +++ b/usr/src/test/os-tests/tests/sockfs/conn.c @@ -20,6 +20,10 @@ * DEALINGS IN THE SOFTWARE. */ +/* + * Copyright 2019 Joyent, Inc. + */ + #include <sys/param.h> #include <sys/types.h> #include <sys/stat.h> @@ -114,8 +118,6 @@ listener(void *varg) exit(1); } } - - exit(0); } /* diff --git a/usr/src/test/util-tests/tests/libnvpair_json/Makefile b/usr/src/test/util-tests/tests/libnvpair_json/Makefile index d1d3585b02..faa76094fe 100644 --- a/usr/src/test/util-tests/tests/libnvpair_json/Makefile +++ b/usr/src/test/util-tests/tests/libnvpair_json/Makefile @@ -10,7 +10,7 @@ # # -# Copyright (c) 2014 Joyent, Inc. +# Copyright 2019 Joyent, Inc. # include $(SRC)/Makefile.master @@ -43,7 +43,8 @@ $(CMDS) := FILEMODE = 0555 LDLIBS += -lnvpair -LINTFLAGS += -erroff=E_FUNC_ARG_UNUSED +# intentional abort() +SMOFF += unreachable all: $(PROG) diff --git a/usr/src/tools/smatch/Makefile b/usr/src/tools/smatch/Makefile index a6379a7e85..dad195adc8 100644 --- a/usr/src/tools/smatch/Makefile +++ b/usr/src/tools/smatch/Makefile @@ -13,14 +13,14 @@ # # The src/ sub-directory is un-modified copy of -# https://github.com/illumos/smatch/tree/0.5.1-il-4 +# https://github.com/illumos/smatch/tree/0.5.1-il-5 # # This Makefile installs just enough for us to be able to run smatch # locally. # PROG = smatch -SPARSE_VERSION = 0.5.1-il-4 +SPARSE_VERSION = 0.5.1-il-5 include ../Makefile.tools @@ -92,9 +92,7 @@ OBJS += target.o parse.o tokenize.o pre-process.o symbol.o lib.o scope.o \ macro_table.o token_store.o hashtable.o SMATCH_DATA = \ - illumos_kernel.no_return_funcs \ illumos_kernel.skipped_functions \ - illumos_user.no_return_funcs \ illumos_user.skipped_functions SMATCH_DB_DATA = \ diff --git a/usr/src/tools/smatch/src/Makefile b/usr/src/tools/smatch/src/Makefile index c1423afbbf..388f5900a1 100644 --- a/usr/src/tools/smatch/src/Makefile +++ b/usr/src/tools/smatch/src/Makefile @@ -1,4 +1,4 @@ -VERSION=0.5.1-il-4 +VERSION=0.5.1-il-5 # Generating file version.h if current version has changed SPARSE_VERSION:=$(shell git describe 2>/dev/null || echo '$(VERSION)') diff --git a/usr/src/tools/smatch/src/check_unreachable.c b/usr/src/tools/smatch/src/check_unreachable.c index 9762ddcfa0..3c0fab0344 100644 --- a/usr/src/tools/smatch/src/check_unreachable.c +++ b/usr/src/tools/smatch/src/check_unreachable.c @@ -172,7 +172,7 @@ static void unreachable_stmt(struct statement *stmt) default: break; } - sm_msg("info: ignoring unreachable code."); + sm_warning("ignoring unreachable code."); print_unreached = 0; } diff --git a/usr/src/tools/smatch/src/parse.c b/usr/src/tools/smatch/src/parse.c index ca4726b80a..44c5970732 100644 --- a/usr/src/tools/smatch/src/parse.c +++ b/usr/src/tools/smatch/src/parse.c @@ -2859,6 +2859,7 @@ struct token *external_declaration(struct token *token, struct symbol_list **lis /* Parse declaration-specifiers, if any */ token = declaration_specifiers(token, &ctx); mod = storage_modifiers(&ctx); + mod |= ctx.ctype.modifiers & MOD_NORETURN; decl = alloc_symbol(token->pos, SYM_NODE); /* Just a type declaration? */ if (match_op(token, ';')) { diff --git a/usr/src/tools/smatch/src/smatch_data/illumos_kernel.no_return_funcs b/usr/src/tools/smatch/src/smatch_data/illumos_kernel.no_return_funcs deleted file mode 100644 index e5e288851d..0000000000 --- a/usr/src/tools/smatch/src/smatch_data/illumos_kernel.no_return_funcs +++ /dev/null @@ -1,18 +0,0 @@ -/* - * These functions don't return. Unfortunately, sparse today doesn't correctly - * respect __NORETURN, so we have to explicitly list them here for now. - */ -__assert_fail -__builtin_unreachable -bop_panic -efi_reset -panic -pc_reset -prom_exit_to_mon -prom_panic -prom_reboot -reset -resume_from_zombie -swtch_from_zombie -thread_exit -vpanic diff --git a/usr/src/tools/smatch/src/smatch_data/illumos_user.no_return_funcs b/usr/src/tools/smatch/src/smatch_data/illumos_user.no_return_funcs deleted file mode 100644 index 730326547b..0000000000 --- a/usr/src/tools/smatch/src/smatch_data/illumos_user.no_return_funcs +++ /dev/null @@ -1,21 +0,0 @@ -/* - * These functions don't return. Unfortunately, sparse today doesn't correctly - * respect __NORETURN, so we have to explicitly list them here for now. - */ -__assert_fail -__builtin_unreachable -abort -ctfmerge_fatal -err -errx -_exit -exit -_longjmp -longjmp -pthread_exit -reparsed_door_call_error -siglongjmp -terminate -thr_exit -verr -verrx diff --git a/usr/src/ucblib/libdbm/dbm.c b/usr/src/ucblib/libdbm/dbm.c index e9afce9d15..82d136c0a7 100644 --- a/usr/src/ucblib/libdbm/dbm.c +++ b/usr/src/ucblib/libdbm/dbm.c @@ -24,7 +24,7 @@ */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* * Portions of this source code were derived from Berkeley 4.3 BSD @@ -32,7 +32,7 @@ */ /* - * Copyright (c) 2018, Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ /*LINTLIBRARY*/ @@ -241,7 +241,7 @@ split: Sentry.dsize = key.dsize; Sentry.dptr = malloc(strlen(key.dptr)+1); (void) strncpy(Sentry.dptr, key.dptr, - key.dsize); + key.dsize); } break; } @@ -442,7 +442,8 @@ cmpdatum(datum d1, datum d2) do if (*p1++ != *p2++) return (*--p1 - *--p2); - while (--n); + while (--n) + ; return (0); } @@ -589,5 +590,4 @@ chkblk(char buf[PBLKSIZ]) bad: (void) printf("bad block\n"); abort(); - bzero(buf, PBLKSIZ); } diff --git a/usr/src/uts/common/contract/device.c b/usr/src/uts/common/contract/device.c index 35daef995a..9eef7ee9b4 100644 --- a/usr/src/uts/common/contract/device.c +++ b/usr/src/uts/common/contract/device.c @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2019 Joyent, Inc. */ #include <sys/mutex.h> @@ -2053,7 +2054,6 @@ contract_device_negotiate(dev_info_t *dip, dev_t dev, int spec_type, cmn_err(CE_PANIC, "contract_device_negotiate(): Negotiation " "not supported: event (%d) for dev_t (%lu) and spec (%d), " "dip (%p)", evtype, dev, spec_type, (void *)dip); - result = CT_NACK; break; } diff --git a/usr/src/uts/common/fs/zfs/vdev_queue.c b/usr/src/uts/common/fs/zfs/vdev_queue.c index a89e06ebbf..0e967b4d83 100644 --- a/usr/src/uts/common/fs/zfs/vdev_queue.c +++ b/usr/src/uts/common/fs/zfs/vdev_queue.c @@ -26,6 +26,7 @@ /* * Copyright (c) 2012, 2018 by Delphix. All rights reserved. * Copyright (c) 2014 Integros [integros.com] + * Copyright 2019 Joyent, Inc. */ #include <sys/zfs_context.h> @@ -405,7 +406,6 @@ vdev_queue_class_min_active(zio_priority_t p) return (zfs_vdev_initializing_min_active); default: panic("invalid priority %u", p); - return (0); } } @@ -468,7 +468,6 @@ vdev_queue_class_max_active(spa_t *spa, zio_priority_t p) return (zfs_vdev_initializing_max_active); default: panic("invalid priority %u", p); - return (0); } } diff --git a/usr/src/uts/common/inet/ip/ip.c b/usr/src/uts/common/inet/ip/ip.c index 3cfdbe73ff..c81331dc9f 100644 --- a/usr/src/uts/common/inet/ip/ip.c +++ b/usr/src/uts/common/inet/ip/ip.c @@ -9103,7 +9103,6 @@ ip_forward_options(mblk_t *mp, ipha_t *ipha, ill_t *dst_ill, */ cmn_err(CE_PANIC, "ip_forward_options: " "unknown IT - bug in ip_input_options?\n"); - return (B_TRUE); /* Keep "lint" happy */ } if (opt[IPOPT_OFFSET] - 1 + off > optlen) { /* Increase overflow counter */ @@ -9330,7 +9329,6 @@ ip_input_local_options(mblk_t *mp, ipha_t *ipha, ip_recv_attr_t *ira) */ cmn_err(CE_PANIC, "ip_input_local_options: " "unknown IT - bug in ip_input_options?\n"); - return (B_TRUE); /* Keep "lint" happy */ } if (opt[IPOPT_OFFSET] - 1 + off > optlen) { /* Increase overflow counter */ @@ -12025,7 +12023,6 @@ ip_output_local_options(ipha_t *ipha, ip_stack_t *ipst) */ cmn_err(CE_PANIC, "ip_output_local_options: " "unknown IT - bug in ip_output_options?\n"); - return; /* Keep "lint" happy */ } if (opt[IPOPT_OFFSET] - 1 + off > optlen) { /* Increase overflow counter */ diff --git a/usr/src/uts/common/io/1394/s1394_dev_disc.c b/usr/src/uts/common/io/1394/s1394_dev_disc.c index ec5c77d48b..08bb639647 100644 --- a/usr/src/uts/common/io/1394/s1394_dev_disc.c +++ b/usr/src/uts/common/io/1394/s1394_dev_disc.c @@ -24,7 +24,9 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright 2019 Joyent, Inc. + */ /* * s1394_dev_disc.c @@ -89,7 +91,7 @@ typedef enum { #define SETUP_QUAD_READ(n, reset_fails, quadlet, cnt) \ { \ int i = (reset_fails); \ - if (i != 0) { \ + if (i != 0) { \ (n)->cfgrom_read_fails = 0; \ (n)->cfgrom_read_delay = (uchar_t)s1394_cfgrom_read_delay_ms; \ } \ @@ -489,7 +491,6 @@ s1394_br_thread_exit(s1394_hal_t *hal) hal->br_thread_ev_type &= ~BR_THR_GO_AWAY; thread_exit(); /*NOTREACHED*/ - TNF_PROBE_0(s1394_br_thread_exit_enter, S1394_TNF_SL_HOTPLUG_STACK, ""); } /* diff --git a/usr/src/uts/common/io/consconfig_dacf.c b/usr/src/uts/common/io/consconfig_dacf.c index 444cb9ce33..1ee860f47f 100644 --- a/usr/src/uts/common/io/consconfig_dacf.c +++ b/usr/src/uts/common/io/consconfig_dacf.c @@ -930,7 +930,6 @@ cons_build_upper_layer(cons_state_t *sp) &wc_lh, sp->cons_li)) { cmn_err(CE_PANIC, "cons_build_upper_layer: " "unable to open wc device"); - return; } ASSERT(wc_dev == sp->cons_wc_vp->v_rdev); diff --git a/usr/src/uts/common/io/i40e/i40e_main.c b/usr/src/uts/common/io/i40e/i40e_main.c index 003997a408..b556f684f9 100644 --- a/usr/src/uts/common/io/i40e/i40e_main.c +++ b/usr/src/uts/common/io/i40e/i40e_main.c @@ -1684,7 +1684,6 @@ i40e_alloc_intr_handles(i40e_t *i40e, dev_info_t *devinfo, int intr_type) default: panic("bad interrupt type passed to i40e_alloc_intr_handles: " "%d", intr_type); - return (B_FALSE); } rc = ddi_intr_get_nintrs(devinfo, intr_type, &count); diff --git a/usr/src/uts/common/io/ntxn/unm_nic_hw.c b/usr/src/uts/common/io/ntxn/unm_nic_hw.c index c3f46d0e19..e7fda06c4a 100644 --- a/usr/src/uts/common/io/ntxn/unm_nic_hw.c +++ b/usr/src/uts/common/io/ntxn/unm_nic_hw.c @@ -25,7 +25,7 @@ */ /* - * Copyright (c) 2018, Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ #include <sys/types.h> @@ -704,7 +704,6 @@ unm_nic_hw_write_wx_2M(unm_adapter *adapter, u64 off, void *data, int len) if (rv == -1) { cmn_err(CE_PANIC, "%s: invalid offset: 0x%016llx\n", __FUNCTION__, off); - return (-1); } if (rv == 1) { @@ -813,7 +812,6 @@ unm_nic_hw_read_wx_2M(unm_adapter *adapter, u64 off, void *data, int len) if (rv == -1) { cmn_err(CE_PANIC, "%s: invalid offset: 0x%016llx\n", __FUNCTION__, off); - return (-1); } if (rv == 1) { @@ -953,7 +951,6 @@ unm_nic_pci_set_window_128M(struct unm_adapter_s *adapter, /* DDR network side */ /* MN access should never come here */ cmn_err(CE_PANIC, "%s\n", __FUNCTION__); - addr = -1ULL; } else if (ADDR_IN_RANGE(addr, UNM_ADDR_OCM0, UNM_ADDR_OCM0_MAX)) { addr -= UNM_ADDR_OCM0; addr += UNM_PCI_OCM0; diff --git a/usr/src/uts/common/io/usbgem/usbgem.c b/usr/src/uts/common/io/usbgem/usbgem.c index d5db88376c..ec31f6f2fe 100644 --- a/usr/src/uts/common/io/usbgem/usbgem.c +++ b/usr/src/uts/common/io/usbgem/usbgem.c @@ -32,6 +32,10 @@ */ /* + * Copyright 2019 Joyent, Inc. + */ + +/* * Change log */ @@ -2051,7 +2055,6 @@ restart_autonego: default: cmn_err(CE_PANIC, "!%s: unknowm linkdown action: %d", dp->name, dp->ugc.usbgc_mii_linkdown_action); - dp->mii_supress_msg = B_TRUE; } /* NOTREACHED */ diff --git a/usr/src/uts/common/os/driver_lyr.c b/usr/src/uts/common/os/driver_lyr.c index 0d6cf16939..9e5eb33dd6 100644 --- a/usr/src/uts/common/os/driver_lyr.c +++ b/usr/src/uts/common/os/driver_lyr.c @@ -22,7 +22,7 @@ * Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. */ /* - * Copyright (c) 2013, Joyent, Inc. All rights reserved. + * Copyright 2019 Joyent, Inc. */ /* @@ -1924,7 +1924,7 @@ ldi_get_size(ldi_handle_t lh, uint64_t *sizep) int ldi_ioctl(ldi_handle_t lh, int cmd, intptr_t arg, int mode, - cred_t *cr, int *rvalp) + cred_t *cr, int *rvalp) { struct ldi_handle *handlep = (struct ldi_handle *)lh; vnode_t *vp; @@ -1999,7 +1999,7 @@ ldi_poll(ldi_handle_t lh, short events, int anyyet, short *reventsp, int ldi_prop_op(ldi_handle_t lh, ddi_prop_op_t prop_op, - int flags, char *name, caddr_t valuep, int *length) + int flags, char *name, caddr_t valuep, int *length) { struct ldi_handle *handlep = (struct ldi_handle *)lh; dev_t dev; @@ -3493,7 +3493,6 @@ ldi_ev_notify(dev_info_t *dip, minor_t minor, int spec_type, if (!ldi_ev_sync_event(evname)) { cmn_err(CE_PANIC, "ldi_ev_notify(): %s not a " "negotiatable event", evname); - return (LDI_EV_SUCCESS); } major = ddi_driver_major(dip); diff --git a/usr/src/uts/common/vm/seg_dev.c b/usr/src/uts/common/vm/seg_dev.c index 89e6461bbf..29896a6374 100644 --- a/usr/src/uts/common/vm/seg_dev.c +++ b/usr/src/uts/common/vm/seg_dev.c @@ -22,7 +22,7 @@ /* * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. - * Copyright 2018 Joyent, Inc. + * Copyright 2019 Joyent, Inc. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ @@ -3988,7 +3988,6 @@ ddi_umem_free(ddi_umem_cookie_t cookie) mutex_exit(&cp->lock); panic("ddi_umem_free for cookie with pending faults %p", (void *)cp); - return; } segkp_release(segkp, cp->cvaddr); diff --git a/usr/src/uts/i86pc/io/amd_iommu/amd_iommu_impl.c b/usr/src/uts/i86pc/io/amd_iommu/amd_iommu_impl.c index 4287c37bb6..1dece88230 100644 --- a/usr/src/uts/i86pc/io/amd_iommu/amd_iommu_impl.c +++ b/usr/src/uts/i86pc/io/amd_iommu/amd_iommu_impl.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved. + * Copyright 2019 Joyent, Inc. */ #include <sys/sunddi.h> @@ -1392,16 +1393,14 @@ amd_iommu_pci_dip(dev_info_t *rdip, const char *path) } } - cmn_err( #ifdef DEBUG - CE_PANIC, + cmn_err(CE_PANIC, "%s: %s%d dip = %p has no PCI parent, path = %s", + f, driver, instance, (void *)rdip, path); #else - CE_WARN, -#endif /* DEBUG */ - "%s: %s%d dip = %p has no PCI parent, path = %s", + cmn_err(CE_WARN, "%s: %s%d dip = %p has no PCI parent, path = %s", f, driver, instance, (void *)rdip, path); - ndi_rele_devi(rdip); +#endif /* DEBUG */ return (NULL); } diff --git a/usr/src/uts/i86pc/os/mp_startup.c b/usr/src/uts/i86pc/os/mp_startup.c index e5be00b6b5..070c69d472 100644 --- a/usr/src/uts/i86pc/os/mp_startup.c +++ b/usr/src/uts/i86pc/os/mp_startup.c @@ -1923,7 +1923,6 @@ mp_startup_common(boolean_t boot) * Now we are done with the startup thread, so free it up. */ thread_exit(); - panic("mp_startup: cannot return"); /*NOTREACHED*/ } |