From nobody Fri Dec 10 08:29:38 2021 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 40E7718E37E8; Fri, 10 Dec 2021 08:29:57 +0000 (UTC) (envelope-from rozhuk.im@gmail.com) Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J9PGX3b2zz4XdR; Fri, 10 Dec 2021 08:29:56 +0000 (UTC) (envelope-from rozhuk.im@gmail.com) Received: by mail-lj1-x22f.google.com with SMTP id i63so12680912lji.3; Fri, 10 Dec 2021 00:29:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:date:to:cc:subject:message-id:mime-version; bh=ELm2y6dbPZGlarzo9PgVfq5ub4AS3vQ4PdnjPoV7hjk=; b=KiUMwissu+BAl0VtHc+FEvD3Exi32DA3UdcLtoUFbKoHRXelwjEpaIMDd8L/kzPwWC +GodOJfXsdMME6usdNypUq3+Mz8/kcwzHcE+BGp1Xj+LIdFrwLw++PNpBsbUxxJwsVJO n3jTvCZGMMRIO2uFe3AU+MrFO31iMOx9/uwr53NR+YYJVcFZ98qjGCiTLjSweelG4pTS t2IllvcQDfjA4sey+YM5tU8lgF1/aRipAu5p2VilevkJvKCC2Xfcqnld6i9gDf/CDny5 drG7Jx3GPW4dse7xijYUb35BKvfYYl1X1+jcuxAhrbjyKnYkMtpT/asD46YYz30wzvC+ N9zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:date:to:cc:subject:message-id:mime-version; bh=ELm2y6dbPZGlarzo9PgVfq5ub4AS3vQ4PdnjPoV7hjk=; b=V+A2P/ReHSsvJhALSXoLuS5FMCjh4N55V3pI0Z+6CtHr3cCTGYNHJkBUPcJn3qprlI SP7AfXy+aBYb9+7IjVs1xgrdQxvxcF3G4F3Lhhu+O4GlptQ9Iwlrk9L+vvTkBwW2qiSc WuMtNaQYnlv03GtViC3pxbAEnOSKJrqmyin1Hj1Qvh0yfIuA3cr6gJO89wmsjDmZj4E/ Jy5gln6q18HTG8N7ld/+uRvAmB4dg+Ql8hxRYEcOLS9OT0g00ZRTm/+AP1l+JigmLNr2 JCpNWvltrVIKNz9aCGPBsrlOO8H7mvLk5hJohbruEhCohCXC7anVo6wPFNAnjVqTHiO3 3JPg== X-Gm-Message-State: AOAM532I1rG+9Ng241isHorSnoFQ6HMCh2Mf6oH00X+3Xd/gWKJ920Wy BhdS0xY1/6pKW+e2eX8WdKxSeYQnptc= X-Google-Smtp-Source: ABdhPJyWs/V/OtZLNL1OaQlOoJLOheZz4pYEO8Dvk/eJWjjWRWpz8TMlyDLmFvL19UHe2nNJr2xAzg== X-Received: by 2002:a2e:1644:: with SMTP id 4mr10940548ljw.312.1639124995277; Fri, 10 Dec 2021 00:29:55 -0800 (PST) Received: from rimwks.local ([176.99.182.246]) by smtp.gmail.com with ESMTPSA id m29sm240049lfj.187.2021.12.10.00.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 00:29:54 -0800 (PST) From: Rozhuk Ivan X-Google-Original-From: Rozhuk Ivan Date: Fri, 10 Dec 2021 11:29:38 +0300 To: freebsd-current@freebsd.org, freebsd-hackers@freebsd.org Cc: Rozhuk Ivan Subject: Too many warnings for world and kernel for 13 stable Message-ID: <20211210112938.21747d4d@rimwks.local> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; amd64-portbld-freebsd13.0) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/wQ+F2DVnjFSjsXA5CnSTh.G" X-Rspamd-Queue-Id: 4J9PGX3b2zz4XdR X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20210112 header.b=KiUMwiss; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of rozhukim@gmail.com designates 2a00:1450:4864:20::22f as permitted sender) smtp.mailfrom=rozhukim@gmail.com X-Spamd-Result: default: False [-0.02 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; HAS_ATTACHMENT(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RECEIVED_SPAMHAUS_PBL(0.00)[176.99.182.246:received]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20210112]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_SPAM_SHORT(0.95)[0.950]; NEURAL_HAM_LONG(-0.97)[-0.968]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::22f:from]; FREEMAIL_CC(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --MP_/wQ+F2DVnjFSjsXA5CnSTh.G Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi! There was a lot warning during build wold and kernel in past with clang 13, but with clang 14 to many warnings. Probably commiters will find some time to fix it? I spent some time to fix/supress warnings for world, exept contrib and stand parts. This patch is not to merge, it is to show that something goes wrong. --MP_/wQ+F2DVnjFSjsXA5CnSTh.G Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=616ca2b8b6.patch From 616ca2b8b63b225be0305d34f36dd3d0050a6a4f Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Fri, 10 Sep 2021 18:50:20 +0300 Subject: [PATCH] Fix build warnings --- lib/geom/eli/geom_eli.c | 4 +- lib/libc/stdlib/rand.c | 4 +- lib/libfetch/http.c | 7 +--- lib/libkvm/kvm_minidump_powerpc64_hpt.c | 3 -- lib/libmd/rmd160c.c | 1 + lib/libmd/sha1c.c | 2 + lib/libpfctl/libpfctl.c | 16 +++---- lib/libpjdlog/pjdlog.c | 5 ++- lib/libprocstat/libprocstat.c | 1 + lib/libvgl/mouse.c | 5 +-- lib/libvmmapi/vmmapi.c | 3 +- lib/ncurses/ncurses/termcap.c | 2 - sbin/bsdlabel/bsdlabel.c | 8 +--- sbin/camcontrol/zone.c | 7 +--- sbin/ggate/ggated/ggated.c | 42 +++++++------------ sbin/growfs/growfs.c | 5 +-- sbin/ipfw/ipfw2.c | 5 +-- sbin/ipfw/nat.c | 3 +- sbin/ipfw/nat64clat.c | 3 +- sbin/ipfw/nat64lsn.c | 3 +- sbin/ipfw/nat64stl.c | 3 +- sbin/ipfw/nptv6.c | 3 +- sbin/ipfw/tables.c | 6 +-- sbin/nvmecontrol/modules/wdc/wdc.c | 3 +- sbin/pfctl/pfctl_optimize.c | 3 -- sbin/recoverdisk/recoverdisk.c | 14 +------ sys/amd64/vmm/vmm_instruction_emul.c | 18 ++------ sys/netinet/libalias/alias.c | 11 +++-- usr.bin/backlight/backlight.c | 3 -- usr.bin/ipcs/ipc.c | 3 +- usr.bin/mkuzip/mkuzip.c | 8 ++-- usr.bin/mt/mt.c | 5 +-- usr.bin/procstat/procstat.c | 3 +- usr.bin/truss/syscalls.c | 7 +--- usr.bin/unifdef/unifdef.c | 5 +-- usr.bin/units/units.c | 5 --- usr.bin/vmstat/vmstat.c | 4 +- usr.bin/vtfontcvt/vtfontcvt.c | 8 ---- usr.sbin/acpi/acpidump/acpi.c | 5 --- usr.sbin/bhyve/atkbdc.c | 12 ++---- usr.sbin/bhyve/bhyverun.c | 12 ++---- usr.sbin/bhyve/gdb.c | 14 ++----- usr.sbin/bhyve/hda_codec.c | 22 +++------- usr.sbin/bhyve/mem.c | 26 ++++-------- usr.sbin/bhyve/mevent.c | 4 +- usr.sbin/bhyve/pci_ahci.c | 20 ++++----- usr.sbin/bhyve/pci_e82545.c | 8 +--- usr.sbin/bhyve/pci_emul.c | 26 ++++-------- usr.sbin/bhyve/pci_hda.c | 31 ++++---------- usr.sbin/bhyve/pci_virtio_block.c | 10 ++--- usr.sbin/bhyve/pci_virtio_console.c | 8 +--- usr.sbin/bhyve/pci_virtio_net.c | 7 +--- usr.sbin/bhyve/pci_virtio_rnd.c | 5 +-- usr.sbin/bhyve/pci_virtio_scsi.c | 4 +- usr.sbin/bhyve/pm.c | 10 +---- usr.sbin/bhyve/rtc.c | 21 ++++------ usr.sbin/bhyve/spinup_ap.c | 22 ++++------ usr.sbin/bhyve/task_switch.c | 22 +++------- usr.sbin/bhyve/uart_emul.c | 13 ++---- usr.sbin/bhyve/vga.c | 8 ++-- usr.sbin/bsdinstall/partedit/scripted.c | 7 ++-- usr.sbin/camdd/camdd.c | 19 +-------- usr.sbin/efibootmgr/efibootmgr.c | 3 +- usr.sbin/efidp/efidp.c | 3 +- .../fifolog/fifolog_reader/fifolog_reader.c | 4 +- usr.sbin/fifolog/lib/fifolog_int.c | 2 +- usr.sbin/fifolog/lib/fifolog_reader.c | 4 +- usr.sbin/fifolog/lib/fifolog_write_poll.c | 2 +- usr.sbin/fifolog/lib/getdate.y | 13 +----- usr.sbin/fwcontrol/fwdv.c | 4 +- usr.sbin/makefs/msdos.c | 2 - usr.sbin/makefs/msdos/msdosfs_vfsops.c | 2 - usr.sbin/mpsutil/mps_debug.c | 2 - usr.sbin/mptable/mptable.c | 3 -- usr.sbin/pmc/cmd_pmc_filter.cc | 3 +- usr.sbin/pw/pw_user.c | 4 +- usr.sbin/rpc.lockd/kern.c | 5 --- usr.sbin/rpc.tlsservd/rpc.tlsservd.c | 3 +- usr.sbin/rrenumd/parser.y | 2 - 79 files changed, 179 insertions(+), 459 deletions(-) diff --git a/lib/geom/eli/geom_eli.c b/lib/geom/eli/geom_eli.c index 4c04a9256b5..5d3cf504e17 100644 --- a/lib/geom/eli/geom_eli.c +++ b/lib/geom/eli/geom_eli.c @@ -1285,7 +1285,6 @@ eli_setkey_attached(struct gctl_req *req, struct g_eli_metadata *md) { unsigned char key[G_ELI_USERKEYLEN]; intmax_t val, old = 0; - int error; val = gctl_get_intmax(req, "iterations"); /* Check if iterations number should be changed. */ @@ -1304,9 +1303,8 @@ eli_setkey_attached(struct gctl_req *req, struct g_eli_metadata *md) * command-line argument, update the request. */ if (val == -1 && md->md_iterations != old) { - error = gctl_change_param(req, "iterations", sizeof(intmax_t), + gctl_change_param(req, "iterations", sizeof(intmax_t), &md->md_iterations); - assert(error == 0); } gctl_ro_param(req, "key", sizeof(key), key); diff --git a/lib/libc/stdlib/rand.c b/lib/libc/stdlib/rand.c index e448d1b1fd1..45ae924dd7a 100644 --- a/lib/libc/stdlib/rand.c +++ b/lib/libc/stdlib/rand.c @@ -71,11 +71,9 @@ static pthread_once_t rand3_state_once = PTHREAD_ONCE_INIT; static void initialize_rand3(void) { - int error; rand3_state = allocatestate(TYPE_3); - error = initstate_r(rand3_state, 1, rand3_state->rst_randtbl, BREAK_3); - assert(error == 0); + initstate_r(rand3_state, 1, rand3_state->rst_randtbl, BREAK_3); } int diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index bcb089dc0fc..c1d92d08b31 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -976,13 +976,12 @@ http_base64(const char *src) "0123456789+/"; char *str, *dst; size_t l; - int t, r; + int t; l = strlen(src); if ((str = malloc(((l + 2) / 3) * 4 + 1)) == NULL) return (NULL); dst = str; - r = 0; while (l >= 3) { t = (src[0] << 16) | (src[1] << 8) | src[2]; @@ -991,7 +990,7 @@ http_base64(const char *src) dst[2] = base64[(t >> 6) & 0x3f]; dst[3] = base64[(t >> 0) & 0x3f]; src += 3; l -= 3; - dst += 4; r += 4; + dst += 4; } switch (l) { @@ -1002,7 +1001,6 @@ http_base64(const char *src) dst[2] = base64[(t >> 6) & 0x3f]; dst[3] = '='; dst += 4; - r += 4; break; case 1: t = src[0] << 16; @@ -1010,7 +1008,6 @@ http_base64(const char *src) dst[1] = base64[(t >> 12) & 0x3f]; dst[2] = dst[3] = '='; dst += 4; - r += 4; break; case 0: break; diff --git a/lib/libkvm/kvm_minidump_powerpc64_hpt.c b/lib/libkvm/kvm_minidump_powerpc64_hpt.c index baa2fd1ebc0..d13f8021a73 100644 --- a/lib/libkvm/kvm_minidump_powerpc64_hpt.c +++ b/lib/libkvm/kvm_minidump_powerpc64_hpt.c @@ -253,9 +253,6 @@ static int ppc64mmu_hpt_init(kvm_t *kd) { struct hpt_data *data; - struct minidumphdr *hdr; - - hdr = &kd->vmst->hdr; /* Alloc MMU data */ data = _kvm_malloc(kd, sizeof(*data)); diff --git a/lib/libmd/rmd160c.c b/lib/libmd/rmd160c.c index a8a4ced70b0..95f56dc6b9a 100644 --- a/lib/libmd/rmd160c.c +++ b/lib/libmd/rmd160c.c @@ -83,6 +83,7 @@ char *RMD160_version="RIPEMD160 part of SSLeay 0.9.0b 11-Oct-1998"; #ifdef RMD160_ASM void ripemd160_block_x86(RIPEMD160_CTX *c, const u_int32_t *p,int num); +#undef ripemd160_block #define ripemd160_block ripemd160_block_x86 #else void ripemd160_block(RIPEMD160_CTX *c, const u_int32_t *p,int num); diff --git a/lib/libmd/sha1c.c b/lib/libmd/sha1c.c index d0bcc35f93d..05223204518 100644 --- a/lib/libmd/sha1c.c +++ b/lib/libmd/sha1c.c @@ -101,6 +101,7 @@ char *SHA1_version="SHA1 part of SSLeay 0.9.0b 11-Oct-1998"; #ifndef NOPROTO # ifdef SHA1_ASM void sha1_block_x86(SHA_CTX *c, const u_int32_t *p, int num); +# undef sha1_block # define sha1_block sha1_block_x86 # else void sha1_block(SHA_CTX *c, const u_int32_t *p, int num); @@ -108,6 +109,7 @@ char *SHA1_version="SHA1 part of SSLeay 0.9.0b 11-Oct-1998"; #else # ifdef SHA1_ASM void sha1_block_x86(); +# undef sha1_block # define sha1_block sha1_block_x86 # else void sha1_block(); diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index 9252f64969b..09c4aba9c94 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -60,8 +60,8 @@ static int _pfctl_clear_states(int , const struct pfctl_kill *, unsigned int *, uint64_t); static void -pf_nvuint_8_array(const nvlist_t *nvl, const char *name, size_t maxelems, - uint8_t *numbers, size_t *nelems) +pf_nvuint_8_array(const nvlist_t *nvl, const char *name, + size_t maxelems __unused, uint8_t *numbers, size_t *nelems) { const uint64_t *tmp; size_t elems; @@ -77,8 +77,8 @@ pf_nvuint_8_array(const nvlist_t *nvl, const char *name, size_t maxelems, } static void -pf_nvuint_16_array(const nvlist_t *nvl, const char *name, size_t maxelems, - uint16_t *numbers, size_t *nelems) +pf_nvuint_16_array(const nvlist_t *nvl, const char *name, + size_t maxelems __unused, uint16_t *numbers, size_t *nelems) { const uint64_t *tmp; size_t elems; @@ -94,8 +94,8 @@ pf_nvuint_16_array(const nvlist_t *nvl, const char *name, size_t maxelems, } static void -pf_nvuint_32_array(const nvlist_t *nvl, const char *name, size_t maxelems, - uint32_t *numbers, size_t *nelems) +pf_nvuint_32_array(const nvlist_t *nvl, const char *name, + size_t maxelems __unused, uint32_t *numbers, size_t *nelems) { const uint64_t *tmp; size_t elems; @@ -111,8 +111,8 @@ pf_nvuint_32_array(const nvlist_t *nvl, const char *name, size_t maxelems, } static void -pf_nvuint_64_array(const nvlist_t *nvl, const char *name, size_t maxelems, - uint64_t *numbers, size_t *nelems) +pf_nvuint_64_array(const nvlist_t *nvl, const char *name, + size_t maxelems __unused, uint64_t *numbers, size_t *nelems) { const uint64_t *tmp; size_t elems; diff --git a/lib/libpjdlog/pjdlog.c b/lib/libpjdlog/pjdlog.c index eb7ddb2b7a8..46d31761f41 100644 --- a/lib/libpjdlog/pjdlog.c +++ b/lib/libpjdlog/pjdlog.c @@ -78,7 +78,7 @@ static char pjdlog_prefix[PJDLOG_PREFIX_STACK][PJDLOG_PREFIX_MAXSIZE]; static int pjdlog_printf_arginfo_humanized_number(const struct printf_info *pi __unused, - size_t n, int *argt) + size_t n __unused, int *argt) { assert(n >= 1); @@ -104,7 +104,7 @@ pjdlog_printf_render_humanized_number(struct __printf_io *io, static int pjdlog_printf_arginfo_sockaddr(const struct printf_info *pi __unused, - size_t n, int *argt) + size_t n __unused, int *argt) { assert(n >= 1); @@ -570,6 +570,7 @@ pjdlogv_common_single_line(const char *func, const char *file, int line, break; default: assert(!"Invalid mode."); + return; } *logp = '\0'; diff --git a/lib/libprocstat/libprocstat.c b/lib/libprocstat/libprocstat.c index 89896a81388..3c2e5222a4c 100644 --- a/lib/libprocstat/libprocstat.c +++ b/lib/libprocstat/libprocstat.c @@ -877,6 +877,7 @@ procstat_getfiles_sysctl(struct procstat *procstat, struct kinfo_proc *kp, break; default: assert(!"invalid type"); + return (NULL); } if (files == NULL && errno != EPERM) { warn("kinfo_getfile()"); diff --git a/lib/libvgl/mouse.c b/lib/libvgl/mouse.c index 010a1b7b9c5..fc7ba239938 100644 --- a/lib/libvgl/mouse.c +++ b/lib/libvgl/mouse.c @@ -284,22 +284,19 @@ VGLMouseInit(int mode) { struct mouse_info mouseinfo; VGLBitmap *ormask; - int andmask, border, error, i, interior; + int border, error, i, interior; switch (VGLModeInfo.vi_mem_model) { case V_INFO_MM_PACKED: case V_INFO_MM_PLANAR: - andmask = 0x0f; border = 0x0f; interior = 0x04; break; case V_INFO_MM_VGAX: - andmask = 0x3f; border = 0x3f; interior = 0x24; break; default: - andmask = 0xff; border = BORDER; interior = INTERIOR; break; diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 0543c92f430..0d3444a24f9 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -391,7 +391,8 @@ setup_memory_segment(struct vmctx *ctx, vm_paddr_t gpa, size_t len, char *base) } int -vm_setup_memory(struct vmctx *ctx, size_t memsize, enum vm_mmap_style vms) +vm_setup_memory(struct vmctx *ctx, size_t memsize, + enum vm_mmap_style vms __unused) { size_t objsize, len; vm_paddr_t gpa; diff --git a/lib/ncurses/ncurses/termcap.c b/lib/ncurses/ncurses/termcap.c index 535301a1b47..9a609537d80 100644 --- a/lib/ncurses/ncurses/termcap.c +++ b/lib/ncurses/ncurses/termcap.c @@ -111,13 +111,11 @@ _nc_read_termcap_entry(const char *const name, TERMTYPE2 *const tp) int i; char pathbuf[PBUFSIZ]; /* holds raw path of filenames */ char *pathvec[PVECSIZ]; /* to point to names in pathbuf */ - char **pvec; /* holds usable tail of path vector */ char *termpath; _nc_termcap[0] = '\0'; /* in case */ dummy = NULL; fname = pathvec; - pvec = pathvec; p = pathbuf; cp = getenv("TERMCAP"); /* diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index 943f37207fc..efe7eebf23c 100644 --- a/sbin/bsdlabel/bsdlabel.c +++ b/sbin/bsdlabel/bsdlabel.c @@ -1094,7 +1094,7 @@ checklabel(struct disklabel *lp) struct partition *pp; int i, errors = 0; char part; - u_long base_offset, needed, total_size, total_percent, current_offset; + u_long base_offset, needed, total_percent, current_offset; long free_space; int seen_default_offset; int hog_part; @@ -1173,7 +1173,6 @@ checklabel(struct disklabel *lp) /* first allocate space to the partitions, then offsets */ - total_size = 0; /* in sectors */ total_percent = 0; /* in percent */ hog_part = -1; /* find all fixed partitions */ @@ -1234,9 +1233,6 @@ checklabel(struct disklabel *lp) size /= lp->d_secsize; pp->p_size = size; } - /* else already in sectors */ - if (i != RAW_PART) - total_size += size; } } } @@ -1272,7 +1268,6 @@ checklabel(struct disklabel *lp) if (part_set[i] && part_size_type[i] == '%') { /* careful of overflows! and integer roundoff */ pp->p_size = ((double)pp->p_size/100) * free_space; - total_size += pp->p_size; /* FIX we can lose a sector or so due to roundoff per partition. A more complex algorithm could avoid that */ @@ -1328,7 +1323,6 @@ checklabel(struct disklabel *lp) } else { lp->d_partitions[hog_part].p_size = current_offset - base_offset - needed; - total_size += lp->d_partitions[hog_part].p_size; } } diff --git a/sbin/camcontrol/zone.c b/sbin/camcontrol/zone.c index 130f53226f5..e6ca6295450 100644 --- a/sbin/camcontrol/zone.c +++ b/sbin/camcontrol/zone.c @@ -138,7 +138,6 @@ zone_rz_print(uint8_t *data_ptr, uint32_t valid_len, int ata_format, struct scsi_report_zones_desc *desc = NULL; uint32_t hdr_len, len; uint64_t max_lba, next_lba = 0; - int more_data = 0; zone_print_status status = ZONE_PRINT_OK; char tmpstr[80]; int field_widths[ZONE_NUM_FIELDS]; @@ -168,7 +167,6 @@ zone_rz_print(uint8_t *data_ptr, uint32_t valid_len, int ata_format, } if (hdr_len > (valid_len + sizeof(*hdr))) { - more_data = 1; status = ZONE_PRINT_MORE_DATA; } @@ -560,7 +558,6 @@ restart_report: case CC_DT_ATA: case CC_DT_SATL: { uint8_t command = 0; - uint8_t protocol = 0; uint16_t features = 0, sector_count = 0; uint32_t auxiliary = 0; @@ -571,7 +568,6 @@ restart_report: */ if (use_ncq == 0) { - protocol = AP_PROTO_NON_DATA; command = ATA_ZAC_MANAGEMENT_OUT; features = action & 0xf; if (all_zones != 0) @@ -581,7 +577,6 @@ restart_report: if (cdb_storage == NULL) err(1, "couldn't allocate memory"); - protocol = AP_PROTO_FPDMA; command = ATA_NCQ_NON_DATA; features = ATA_NCQ_ZAC_MGMT_OUT; auxiliary = action & 0xf; @@ -594,7 +589,7 @@ restart_report: /*retry_count*/ retry_count, /*flags*/ CAM_DIR_NONE | CAM_DEV_QFRZDIS, /*tag_action*/ task_attr, - /*protocol*/ AP_PROTO_NON_DATA, + /*protocol???? AP_PROTO_FPDMA*/ AP_PROTO_NON_DATA, /*ata_flags*/ AP_FLAG_BYT_BLOK_BYTES | AP_FLAG_TLEN_NO_DATA, /*features*/ features, diff --git a/sbin/ggate/ggated/ggated.c b/sbin/ggate/ggated/ggated.c index 226ba1ce72d..03aabd271da 100644 --- a/sbin/ggate/ggated/ggated.c +++ b/sbin/ggate/ggated/ggated.c @@ -639,7 +639,7 @@ recv_thread(void *arg) struct ggd_connection *conn; struct ggd_request *req; ssize_t data; - int error, fd; + int fd; conn = arg; g_gate_log(LOG_NOTICE, "%s: started [%s]!", __func__, conn->c_path); @@ -688,13 +688,10 @@ recv_thread(void *arg) /* * Put the request onto the incoming queue. */ - error = pthread_mutex_lock(&inqueue_mtx); - assert(error == 0); + pthread_mutex_lock(&inqueue_mtx); TAILQ_INSERT_TAIL(&inqueue, req, r_next); - error = pthread_cond_signal(&inqueue_cond); - assert(error == 0); - error = pthread_mutex_unlock(&inqueue_mtx); - assert(error == 0); + pthread_cond_signal(&inqueue_cond); + pthread_mutex_unlock(&inqueue_mtx); } } @@ -704,7 +701,7 @@ disk_thread(void *arg) struct ggd_connection *conn; struct ggd_request *req; ssize_t data; - int error, fd; + int fd; conn = arg; g_gate_log(LOG_NOTICE, "%s: started [%s]!", __func__, conn->c_path); @@ -713,15 +710,12 @@ disk_thread(void *arg) /* * Get a request from the incoming queue. */ - error = pthread_mutex_lock(&inqueue_mtx); - assert(error == 0); + pthread_mutex_lock(&inqueue_mtx); while ((req = TAILQ_FIRST(&inqueue)) == NULL) { - error = pthread_cond_wait(&inqueue_cond, &inqueue_mtx); - assert(error == 0); + pthread_cond_wait(&inqueue_cond, &inqueue_mtx); } TAILQ_REMOVE(&inqueue, req, r_next); - error = pthread_mutex_unlock(&inqueue_mtx); - assert(error == 0); + pthread_mutex_unlock(&inqueue_mtx); /* * Check the request. @@ -766,13 +760,10 @@ disk_thread(void *arg) /* * Put the request onto the outgoing queue. */ - error = pthread_mutex_lock(&outqueue_mtx); - assert(error == 0); + pthread_mutex_lock(&outqueue_mtx); TAILQ_INSERT_TAIL(&outqueue, req, r_next); - error = pthread_cond_signal(&outqueue_cond); - assert(error == 0); - error = pthread_mutex_unlock(&outqueue_mtx); - assert(error == 0); + pthread_cond_signal(&outqueue_cond); + pthread_mutex_unlock(&outqueue_mtx); } /* NOTREACHED */ @@ -785,7 +776,7 @@ send_thread(void *arg) struct ggd_connection *conn; struct ggd_request *req; ssize_t data; - int error, fd; + int fd; conn = arg; g_gate_log(LOG_NOTICE, "%s: started [%s]!", __func__, conn->c_path); @@ -794,16 +785,13 @@ send_thread(void *arg) /* * Get a request from the outgoing queue. */ - error = pthread_mutex_lock(&outqueue_mtx); - assert(error == 0); + pthread_mutex_lock(&outqueue_mtx); while ((req = TAILQ_FIRST(&outqueue)) == NULL) { - error = pthread_cond_wait(&outqueue_cond, + pthread_cond_wait(&outqueue_cond, &outqueue_mtx); - assert(error == 0); } TAILQ_REMOVE(&outqueue, req, r_next); - error = pthread_mutex_unlock(&outqueue_mtx); - assert(error == 0); + pthread_mutex_unlock(&outqueue_mtx); g_gate_log(LOG_DEBUG, "%s: offset=%" PRIu64 " length=%" PRIu32, __func__, req->r_offset, req->r_length); diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c index 1f1bcf82c96..6a57924fb7b 100644 --- a/sbin/growfs/growfs.c +++ b/sbin/growfs/growfs.c @@ -560,7 +560,7 @@ static void updjcg(int cylno, time_t modtime, int fsi, int fso, unsigned int Nflag) { DBG_FUNC("updjcg") - ufs2_daddr_t cbase, dmax, dupper; + ufs2_daddr_t cbase, dmax; struct csum *cs; int i, k; int j = 0; @@ -607,9 +607,6 @@ updjcg(int cylno, time_t modtime, int fsi, int fso, unsigned int Nflag) dmax = cbase + sblock.fs_fpg; if (dmax > sblock.fs_size) dmax = sblock.fs_size; - dupper = cgdmin(&sblock, cylno) - cbase; - if (cylno == 0) /* XXX fscs may be relocated */ - dupper += howmany(sblock.fs_cssize, sblock.fs_fsize); /* * Set pointer to the cylinder summary for our cylinder group. diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index e210cbfd02e..35f7ef2e4c4 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -2650,7 +2650,6 @@ list_static_range(struct cmdline_opts *co, struct format_opts *fo, int n, seen; struct ip_fw_rule *r; struct ip_fw_bcounter *cntr; - int c = 0; for (n = seen = 0; n < rcnt; n++, rtlv = (ipfw_obj_tlv *)((caddr_t)rtlv + rtlv->length)) { @@ -2669,7 +2668,6 @@ list_static_range(struct cmdline_opts *co, struct format_opts *fo, if (r->rulenum >= fo->first && r->rulenum <= fo->last) { show_static_rule(co, fo, bp, r, cntr); printf("%s", bp->buf); - c += rtlv->length; bp_flush(bp); seen++; } @@ -2788,13 +2786,12 @@ ipfw_show_config(struct cmdline_opts *co, struct format_opts *fo, char *endptr; size_t readsz; struct buf_pr bp; - ipfw_obj_ctlv *ctlv, *tstate; + ipfw_obj_ctlv *ctlv; ipfw_obj_tlv *rbase; /* * Handle tablenames TLV first, if any */ - tstate = NULL; rbase = NULL; dynbase = NULL; dynsz = 0; diff --git a/sbin/ipfw/nat.c b/sbin/ipfw/nat.c index 1076e1038b8..bb2a63e21e9 100644 --- a/sbin/ipfw/nat.c +++ b/sbin/ipfw/nat.c @@ -1074,7 +1074,6 @@ nat_foreach(nat_cb_t *f, void *arg, int sort) struct nat44_cfg_nat *cfg; size_t sz; uint32_t i; - int error; /* Start with reasonable default */ sz = sizeof(*olh) + 16 * sizeof(struct nat44_cfg_nat); @@ -1097,7 +1096,7 @@ nat_foreach(nat_cb_t *f, void *arg, int sort) cfg = (struct nat44_cfg_nat*)(olh + 1); for (i = 0; i < olh->count; i++) { - error = f(cfg, arg); /* Ignore errors for now */ + f(cfg, arg); /* Ignore errors for now */ cfg = (struct nat44_cfg_nat *)((caddr_t)cfg + olh->objsize); } diff --git a/sbin/ipfw/nat64clat.c b/sbin/ipfw/nat64clat.c index 962fe7064f8..25d0689ca5f 100644 --- a/sbin/ipfw/nat64clat.c +++ b/sbin/ipfw/nat64clat.c @@ -505,7 +505,6 @@ nat64clat_foreach(nat64clat_cb_t *f, const char *name, uint8_t set, int sort) ipfw_nat64clat_cfg *cfg; size_t sz; uint32_t i; - int error; /* Start with reasonable default */ sz = sizeof(*olh) + 16 * sizeof(*cfg); @@ -528,7 +527,7 @@ nat64clat_foreach(nat64clat_cb_t *f, const char *name, uint8_t set, int sort) cfg = (ipfw_nat64clat_cfg *)(olh + 1); for (i = 0; i < olh->count; i++) { - error = f(cfg, name, set); /* Ignore errors for now */ + f(cfg, name, set); /* Ignore errors for now */ cfg = (ipfw_nat64clat_cfg *)((caddr_t)cfg + olh->objsize); } diff --git a/sbin/ipfw/nat64lsn.c b/sbin/ipfw/nat64lsn.c index ff36181815d..b9b58042e94 100644 --- a/sbin/ipfw/nat64lsn.c +++ b/sbin/ipfw/nat64lsn.c @@ -853,7 +853,6 @@ nat64lsn_foreach(nat64lsn_cb_t *f, const char *name, uint8_t set, int sort) ipfw_nat64lsn_cfg *cfg; size_t sz; uint32_t i; - int error; /* Start with reasonable default */ sz = sizeof(*olh) + 16 * sizeof(ipfw_nat64lsn_cfg); @@ -877,7 +876,7 @@ nat64lsn_foreach(nat64lsn_cb_t *f, const char *name, uint8_t set, int sort) cfg = (ipfw_nat64lsn_cfg *)(olh + 1); for (i = 0; i < olh->count; i++) { - error = f(cfg, name, set); /* Ignore errors for now */ + f(cfg, name, set); /* Ignore errors for now */ cfg = (ipfw_nat64lsn_cfg *)((caddr_t)cfg + olh->objsize); } diff --git a/sbin/ipfw/nat64stl.c b/sbin/ipfw/nat64stl.c index e82ec202b5c..ec1d11aaad4 100644 --- a/sbin/ipfw/nat64stl.c +++ b/sbin/ipfw/nat64stl.c @@ -521,7 +521,6 @@ nat64stl_foreach(nat64stl_cb_t *f, const char *name, uint8_t set, int sort) ipfw_nat64stl_cfg *cfg; size_t sz; uint32_t i; - int error; /* Start with reasonable default */ sz = sizeof(*olh) + 16 * sizeof(*cfg); @@ -544,7 +543,7 @@ nat64stl_foreach(nat64stl_cb_t *f, const char *name, uint8_t set, int sort) cfg = (ipfw_nat64stl_cfg *)(olh + 1); for (i = 0; i < olh->count; i++) { - error = f(cfg, name, set); /* Ignore errors for now */ + f(cfg, name, set); /* Ignore errors for now */ cfg = (ipfw_nat64stl_cfg *)((caddr_t)cfg + olh->objsize); } diff --git a/sbin/ipfw/nptv6.c b/sbin/ipfw/nptv6.c index f2ebbdb6518..a158299eb37 100644 --- a/sbin/ipfw/nptv6.c +++ b/sbin/ipfw/nptv6.c @@ -420,7 +420,6 @@ nptv6_foreach(nptv6_cb_t *f, const char *name, uint8_t set, int sort) ipfw_nptv6_cfg *cfg; size_t sz; uint32_t i; - int error; /* Start with reasonable default */ sz = sizeof(*olh) + 16 * sizeof(*cfg); @@ -442,7 +441,7 @@ nptv6_foreach(nptv6_cb_t *f, const char *name, uint8_t set, int sort) cfg = (ipfw_nptv6_cfg *)(olh + 1); for (i = 0; i < olh->count; i++) { - error = f(cfg, name, set); + f(cfg, name, set); cfg = (ipfw_nptv6_cfg *)((caddr_t)cfg + olh->objsize); } free(olh); diff --git a/sbin/ipfw/tables.c b/sbin/ipfw/tables.c index 81cf7e39258..c3c2173f48e 100644 --- a/sbin/ipfw/tables.c +++ b/sbin/ipfw/tables.c @@ -1386,7 +1386,6 @@ guess_key_type(char *key, uint8_t *ptype) { char *p; struct in6_addr addr; - uint32_t kv; if (ishexnumber(*key) != 0 || *key == ':') { /* Remove / if exists */ @@ -1402,7 +1401,7 @@ guess_key_type(char *key, uint8_t *ptype) } else { /* Port or any other key */ /* Skip non-base 10 entries like 'fa1' */ - kv = strtol(key, &p, 10); + strtol(key, &p, 10); if (*p == '\0') { *ptype = IPFW_TABLE_NUMBER; return (0); @@ -1685,7 +1684,6 @@ tables_foreach(table_cb_t *f, void *arg, int sort) ipfw_xtable_info *info; size_t sz; uint32_t i; - int error; /* Start with reasonable default */ sz = sizeof(*olh) + 16 * sizeof(ipfw_xtable_info); @@ -1710,7 +1708,7 @@ tables_foreach(table_cb_t *f, void *arg, int sort) info = (ipfw_xtable_info *)(olh + 1); for (i = 0; i < olh->count; i++) { if (g_co.use_set == 0 || info->set == g_co.use_set - 1) - error = f(info, arg); + f(info, arg); info = (ipfw_xtable_info *)((caddr_t)info + olh->objsize); } diff --git a/sbin/nvmecontrol/modules/wdc/wdc.c b/sbin/nvmecontrol/modules/wdc/wdc.c index 050458a8812..cfef69d8b69 100644 --- a/sbin/nvmecontrol/modules/wdc/wdc.c +++ b/sbin/nvmecontrol/modules/wdc/wdc.c @@ -783,7 +783,6 @@ static void print_hgst_info_log(const struct nvme_controller_data *cdata __unused, void *buf, uint32_t size __unused) { uint8_t *walker, *end, *subpage; - int pages; uint16_t len; uint8_t subtype, res; @@ -791,7 +790,7 @@ print_hgst_info_log(const struct nvme_controller_data *cdata __unused, void *buf printf("===================\n"); walker = buf; - pages = *walker++; + walker++; /* Pages */ walker++; len = le16dec(walker); walker += 2; diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index cb557884067..d999734a906 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -817,7 +817,6 @@ block_feedback(struct pfctl *pf, struct superblock *block) { TAILQ_HEAD( , pf_opt_rule) queue; struct pf_opt_rule *por1, *por2; - u_int64_t total_count = 0; struct pfctl_rule a, b; @@ -827,8 +826,6 @@ block_feedback(struct pfctl *pf, struct superblock *block) */ TAILQ_FOREACH(por1, &block->sb_profiled_block->sb_rules, por_entry) { comparable_rule(&a, &por1->por_rule, DC); - total_count += por1->por_rule.packets[0] + - por1->por_rule.packets[1]; TAILQ_FOREACH(por2, &block->sb_rules, por_entry) { if (por2->por_profile_count) continue; diff --git a/sbin/recoverdisk/recoverdisk.c b/sbin/recoverdisk/recoverdisk.c index 8c4aabebc76..0f3388f9933 100644 --- a/sbin/recoverdisk/recoverdisk.c +++ b/sbin/recoverdisk/recoverdisk.c @@ -32,9 +32,7 @@ /* Safe printf into a fixed-size buffer */ #define bprintf(buf, fmt, ...) \ do { \ - int ibprintf; \ - ibprintf = snprintf(buf, sizeof buf, fmt, __VA_ARGS__); \ - assert(ibprintf >= 0 && ibprintf < (int)sizeof buf); \ + snprintf(buf, sizeof buf, fmt, __VA_ARGS__); \ } while (0) struct lump { @@ -79,8 +77,7 @@ static void report_good_read2(time_t now, size_t bytes, struct period_head *ph, time_t dt) { struct period *pp; - const char *fmt; - struct tm tm1; + struct tm tm1 __unused; pp = TAILQ_FIRST(ph); if (pp == NULL || pp->t1 < now) { @@ -89,11 +86,6 @@ report_good_read2(time_t now, size_t bytes, struct period_head *ph, time_t dt) pp->t0 = (now / dt) * dt; pp->t1 = (now / dt + 1) * dt; assert(localtime_r(&pp->t0, &tm1) != NULL); - if (dt < 86400) - fmt = "%H:%M"; - else - fmt = "%d%b"; - assert(strftime(pp->str, sizeof pp->str, fmt, &tm1) != 0); TAILQ_INSERT_HEAD(ph, pp, list); } pp->bytes_read += bytes; @@ -149,12 +141,10 @@ static void set_verbose(void) { struct winsize wsz; - time_t t0; if (!isatty(STDIN_FILENO) || ioctl(STDIN_FILENO, TIOCGWINSZ, &wsz)) return; verbose = 1; - t0 = time(NULL); } static void diff --git a/sys/amd64/vmm/vmm_instruction_emul.c b/sys/amd64/vmm/vmm_instruction_emul.c index ae022210893..a2ee81761c7 100644 --- a/sys/amd64/vmm/vmm_instruction_emul.c +++ b/sys/amd64/vmm/vmm_instruction_emul.c @@ -717,21 +717,11 @@ get_gla(void *vm, int vcpuid, struct vie *vie, struct vm_guest_paging *paging, { struct seg_desc desc; uint64_t cr0, val, rflags; - int error; - - error = vie_read_register(vm, vcpuid, VM_REG_GUEST_CR0, &cr0); - KASSERT(error == 0, ("%s: error %d getting cr0", __func__, error)); - - error = vie_read_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, &rflags); - KASSERT(error == 0, ("%s: error %d getting rflags", __func__, error)); - - error = vm_get_seg_desc(vm, vcpuid, seg, &desc); - KASSERT(error == 0, ("%s: error %d getting segment descriptor %d", - __func__, error, seg)); - error = vie_read_register(vm, vcpuid, gpr, &val); - KASSERT(error == 0, ("%s: error %d getting register %d", __func__, - error, gpr)); + vie_read_register(vm, vcpuid, VM_REG_GUEST_CR0, &cr0); + vie_read_register(vm, vcpuid, VM_REG_GUEST_RFLAGS, &rflags); + vm_get_seg_desc(vm, vcpuid, seg, &desc); + vie_read_register(vm, vcpuid, gpr, &val); if (vie_calculate_gla(paging->cpu_mode, seg, &desc, val, opsize, addrsize, prot, gla)) { diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c index 39e9b060623..b70c6458c80 100644 --- a/sys/netinet/libalias/alias.c +++ b/sys/netinet/libalias/alias.c @@ -827,7 +827,6 @@ UdpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) u_short dest_port; u_short proxy_server_port; int proxy_type; - int error; size_t dlen; LIBALIAS_LOCK_ASSERT(la); @@ -899,7 +898,7 @@ UdpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) alias_port = GetAliasPort(lnk); /* Walk out chain. */ - error = find_handler(OUT, UDP, la, pip, &ad); + find_handler(OUT, UDP, la, pip, &ad); /* If UDP checksum is not zero, adjust since source port is */ /* being aliased and source address is being altered */ @@ -949,7 +948,7 @@ TcpAliasIn(struct libalias *la, struct ip *pip) struct in_addr proxy_address; u_short alias_port; u_short proxy_port; - int accumulate, error; + int accumulate; /* * The init of MANY vars is a bit below, but aliashandlepptpin @@ -968,7 +967,7 @@ TcpAliasIn(struct libalias *la, struct ip *pip) }; /* Walk out chain. */ - error = find_handler(IN, TCP, la, pip, &ad); + find_handler(IN, TCP, la, pip, &ad); alias_address = GetAliasAddress(lnk); original_address = GetOriginalAddress(lnk); @@ -1055,7 +1054,7 @@ TcpAliasIn(struct libalias *la, struct ip *pip) static int TcpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) { - int proxy_type, error; + int proxy_type; u_short dest_port; u_short proxy_server_port; size_t dlen; @@ -1137,7 +1136,7 @@ TcpAliasOut(struct libalias *la, struct ip *pip, int maxpacketsize, int create) TcpMonitorOut(tc->th_flags, lnk); /* Walk out chain. */ - error = find_handler(OUT, TCP, la, pip, &ad); + find_handler(OUT, TCP, la, pip, &ad); /* Adjust TCP checksum since source port is being aliased * and source address is being altered */ diff --git a/usr.bin/backlight/backlight.c b/usr.bin/backlight/backlight.c index 9cf7a0912e9..7c3f295223f 100644 --- a/usr.bin/backlight/backlight.c +++ b/usr.bin/backlight/backlight.c @@ -101,11 +101,9 @@ main(int argc, char *argv[]) long percent = -1; const char *percent_error; uint32_t i; - bool setname; bool quiet = false; action = BACKLIGHT_QUERY; - setname = false; fd = -1; while ((ch = getopt(argc, argv, "f:qhi")) != -1) { @@ -114,7 +112,6 @@ main(int argc, char *argv[]) quiet = true; break; case 'f': - setname = true; set_device_name(optarg); break; case 'i': diff --git a/usr.bin/ipcs/ipc.c b/usr.bin/ipcs/ipc.c index d48389dd54b..6a128ba58b1 100644 --- a/usr.bin/ipcs/ipc.c +++ b/usr.bin/ipcs/ipc.c @@ -106,7 +106,8 @@ static struct scgs_vector msginfo_scgsv[] = { MSGINFO_XVEC { .sysctl=NULL } }; kvm_t *kd; void -sysctlgatherstruct(void *addr, size_t size, struct scgs_vector *vecarr) +sysctlgatherstruct(void *addr, size_t size __unused, + struct scgs_vector *vecarr) { struct scgs_vector *xp; size_t tsiz; diff --git a/usr.bin/mkuzip/mkuzip.c b/usr.bin/mkuzip/mkuzip.c index a2763e06440..43fb4f49d73 100644 --- a/usr.bin/mkuzip/mkuzip.c +++ b/usr.bin/mkuzip/mkuzip.c @@ -128,9 +128,8 @@ int main(int argc, char **argv) uint64_t offset, last_offset; struct cloop_header hdr; struct mkuz_conveyor *cvp; - void *c_ctx; struct mkuz_blk_info *chit; - size_t ncpusz, ncpu, magiclen; + size_t ncpusz, ncpu; double st, et; enum UZ_ALGORITHM comp_alg; int comp_level; @@ -233,8 +232,7 @@ int main(int argc, char **argv) cfs.handler = &uzip_fmts[comp_alg]; - magiclen = strlcpy(hdr.magic, cfs.handler->magic, sizeof(hdr.magic)); - assert(magiclen < sizeof(hdr.magic)); + strlcpy(hdr.magic, cfs.handler->magic, sizeof(hdr.magic)); if (cfs.en_dedup != 0) { /* @@ -255,7 +253,7 @@ int main(int argc, char **argv) errx(1, "maximal compressed cluster size %zu greater than MAXPHYS %zu", cfs.cbound_blksz, (size_t)MAXPHYS); - c_ctx = cfs.handler->f_init(&comp_level); + cfs.handler->f_init(&comp_level); cfs.comp_level = comp_level; cfs.iname = argv[0]; diff --git a/usr.bin/mt/mt.c b/usr.bin/mt/mt.c index a053cdd9213..73b54e24217 100644 --- a/usr.bin/mt/mt.c +++ b/usr.bin/mt/mt.c @@ -1555,15 +1555,12 @@ mt_getdensity(int argc, char **argv, char *xml_str, struct mt_status_data *status_data) { int retval = 0; - int verbose = 0, xml_dump = 0; + int xml_dump = 0; struct mt_status_entry *density_root = NULL; int c; while ((c = getopt(argc, argv, "vx")) != -1) { switch (c) { - case 'v': - verbose = 1; - break; case 'x': xml_dump = 1; break; diff --git a/usr.bin/procstat/procstat.c b/usr.bin/procstat/procstat.c index a1cd082ecb5..bb3b9e9de5a 100644 --- a/usr.bin/procstat/procstat.c +++ b/usr.bin/procstat/procstat.c @@ -236,11 +236,10 @@ static const struct procstat_cmd * getcmdbyprogname(const char *pprogname) { const char *ca; - size_t i, len; + size_t i; if (pprogname == NULL) return (NULL); - len = strlen(pprogname); for (i = 0; i < nitems(pacmd_table); i++) { ca = pacmd_table[i].command; diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 6740ab21ff2..bdad78e66a2 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -977,18 +977,15 @@ print_mask_arg32(bool (*decoder)(FILE *, uint32_t, uint32_t *), FILE *fp, static void quad_fixup(struct syscall_decode *sc) { - int offset, prev; + int offset; u_int i; offset = 0; - prev = -1; for (i = 0; i < sc->nargs; i++) { /* This arg type is a dummy that doesn't use offset. */ if ((sc->args[i].type & ARG_MASK) == PipeFds) continue; - assert(prev < sc->args[i].offset); - prev = sc->args[i].offset; sc->args[i].offset += offset; switch (sc->args[i].type & ARG_MASK) { case Quad: @@ -2128,11 +2125,9 @@ print_arg(struct syscall_arg *sc, unsigned long *args, register_t *retval, fputs(strsig2(args[sc->offset]), fp); break; case Sigset: { - long sig; sigset_t ss; int i, first; - sig = args[sc->offset]; if (get_struct(pid, args[sc->offset], (void *)&ss, sizeof(ss)) == -1) { print_pointer(fp, args[sc->offset]); diff --git a/usr.bin/unifdef/unifdef.c b/usr.bin/unifdef/unifdef.c index 50331d5ad9b..b7381a0b46b 100644 --- a/usr.bin/unifdef/unifdef.c +++ b/usr.bin/unifdef/unifdef.c @@ -1556,7 +1556,7 @@ static void addsym2(bool ignorethis, const char *symname, const char *val) { const char *cp = symname; - struct macro *sym, *r; + struct macro *sym; sym = findsym(&cp); if (sym == NULL) { @@ -1564,8 +1564,7 @@ addsym2(bool ignorethis, const char *symname, const char *val) sym->ignore = ignorethis; sym->name = symname; sym->value = val; - r = RB_INSERT(MACROMAP, ¯o_tree, sym); - assert(r == NULL); + RB_INSERT(MACROMAP, ¯o_tree, sym); } debugsym("addsym", sym); } diff --git a/usr.bin/units/units.c b/usr.bin/units/units.c index 02aeb60606f..f547ab66acc 100644 --- a/usr.bin/units/units.c +++ b/usr.bin/units/units.c @@ -763,11 +763,9 @@ main(int argc, char **argv) EditLine *el; HistEvent ev; int inputsz; - char const * history_file; quiet = false; readfile = false; - history_file = NULL; outputformat = numfmt; quit = false; while ((optchar = getopt_long(argc, argv, "+ehf:o:qtvH:UV", longopts, NULL)) != -1) { @@ -782,9 +780,6 @@ main(int argc, char **argv) else readunits(optarg); break; - case 'H': - history_file = optarg; - break; case 'q': quiet = true; break; diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index 403dc6e2a05..7318d0ed6f1 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -670,12 +670,11 @@ dovmstat(unsigned int interval, int reps) u_long cpumask; size_t size; time_t uptime, halfuptime; - int ncpus, maxid, rate_adj, retval; + int maxid, rate_adj, retval; uptime = getuptime() / 1000000000LL; halfuptime = uptime / 2; rate_adj = 1; - ncpus = 1; maxid = 0; cpumask = 0; @@ -714,7 +713,6 @@ dovmstat(unsigned int interval, int reps) } if (Pflag) { - ncpus = getcpuinfo(&cpumask, &maxid); size_cp_times = sizeof(long) * (maxid + 1) * CPUSTATES; cur_cp_times = calloc(1, size_cp_times); last_cp_times = calloc(1, size_cp_times); diff --git a/usr.bin/vtfontcvt/vtfontcvt.c b/usr.bin/vtfontcvt/vtfontcvt.c index fbfc0539b4d..86b06a9a6f2 100644 --- a/usr.bin/vtfontcvt/vtfontcvt.c +++ b/usr.bin/vtfontcvt/vtfontcvt.c @@ -721,12 +721,9 @@ write_mappings(FILE *fp, unsigned int map_idx) struct mapping_list *ml = &maps[map_idx]; struct mapping *mp; vfnt_map_t fm; - unsigned int i = 0, j = 0; TAILQ_FOREACH(mp, ml, m_list) { - j++; if (mp->m_length > 0) { - i += mp->m_length; fm.vfm_src = htobe32(mp->m_char); fm.vfm_dst = htobe16(mp->m_glyph->g_index); fm.vfm_len = htobe16(mp->m_length - 1); @@ -734,7 +731,6 @@ write_mappings(FILE *fp, unsigned int map_idx) return (1); } } - assert(i == j); return (0); } @@ -743,19 +739,15 @@ write_source_mappings(FILE *fp, unsigned int map_idx) { struct mapping_list *ml = &maps[map_idx]; struct mapping *mp; - unsigned int i = 0, j = 0; TAILQ_FOREACH(mp, ml, m_list) { - j++; if (mp->m_length > 0) { - i += mp->m_length; if (fprintf(fp, "\t{ 0x%08x, 0x%04x, 0x%04x },\n", mp->m_char, mp->m_glyph->g_index, mp->m_length - 1) < 0) return (1); } } - assert(i == j); return (0); } diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c index adb5b968f44..25a0f577b20 100644 --- a/usr.sbin/acpi/acpidump/acpi.c +++ b/usr.sbin/acpi/acpidump/acpi.c @@ -1576,7 +1576,6 @@ acpi_print_nfit(ACPI_NFIT_HEADER *nfit) ACPI_NFIT_SYSTEM_ADDRESS *sysaddr; ACPI_NFIT_MEMORY_MAP *mmap; ACPI_NFIT_INTERLEAVE *ileave; - ACPI_NFIT_SMBIOS *smbios; ACPI_NFIT_CONTROL_REGION *ctlreg; ACPI_NFIT_DATA_REGION *datareg; ACPI_NFIT_FLUSH_ADDRESS *fladdr; @@ -1650,10 +1649,6 @@ acpi_print_nfit(ACPI_NFIT_HEADER *nfit) printf("\tLineSize=%u\n", (u_int)ileave->LineSize); /* XXX ileave->LineOffset[i] output is not supported */ break; - case ACPI_NFIT_TYPE_SMBIOS: - smbios = (ACPI_NFIT_SMBIOS *)nfit; - /* XXX smbios->Data[x] output is not supported */ - break; case ACPI_NFIT_TYPE_CONTROL_REGION: ctlreg = (ACPI_NFIT_CONTROL_REGION *)nfit; printf("\tRegionIndex=%u\n", (u_int)ctlreg->RegionIndex); diff --git a/usr.sbin/bhyve/atkbdc.c b/usr.sbin/bhyve/atkbdc.c index a08f58f84b2..df0f2661c8a 100644 --- a/usr.sbin/bhyve/atkbdc.c +++ b/usr.sbin/bhyve/atkbdc.c @@ -397,7 +397,7 @@ atkbdc_sts_ctl_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, uint32_t *eax, void *arg) { struct atkbdc_softc *sc; - int error, retval; + int retval; if (bytes != 1) return (-1); @@ -467,8 +467,7 @@ atkbdc_sts_ctl_handler(struct vmctx *ctx, int vcpu, int in, int port, sc->status |= KBDS_AUX_BUFFER_FULL | KBDS_KBD_BUFFER_FULL; break; case KBDC_RESET: /* Pulse "reset" line */ - error = vm_suspend(ctx, VM_SUSPEND_RESET); - assert(error == 0 || errno == EALREADY); + vm_suspend(ctx, VM_SUSPEND_RESET); break; default: if (*eax >= 0x21 && *eax <= 0x3f) { @@ -516,7 +515,6 @@ atkbdc_init(struct vmctx *ctx) { struct inout_port iop; struct atkbdc_softc *sc; - int error; sc = calloc(1, sizeof(struct atkbdc_softc)); sc->ctx = ctx; @@ -531,8 +529,7 @@ atkbdc_init(struct vmctx *ctx) iop.handler = atkbdc_sts_ctl_handler; iop.arg = sc; - error = register_inout(&iop); - assert(error == 0); + register_inout(&iop); bzero(&iop, sizeof(struct inout_port)); iop.name = "atkdbc"; @@ -542,8 +539,7 @@ atkbdc_init(struct vmctx *ctx) iop.handler = atkbdc_data_handler; iop.arg = sc; - error = register_inout(&iop); - assert(error == 0); + register_inout(&iop); pci_irq_reserve(KBD_DEV_IRQ); sc->kbd.irq = KBD_DEV_IRQ; diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index e4d96d2293f..d5bfc00f35d 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -488,14 +488,13 @@ vm_inject_fault(void *arg, int vcpu, int vector, int errcode_valid, int errcode) { struct vmctx *ctx; - int error, restart_instruction; + int restart_instruction; ctx = arg; restart_instruction = 1; - error = vm_inject_exception(ctx, vcpu, vector, errcode_valid, errcode, + vm_inject_exception(ctx, vcpu, vector, errcode_valid, errcode, restart_instruction); - assert(error == 0); } void * @@ -1136,15 +1135,12 @@ do_open(const char *vmname) void spinup_vcpu(struct vmctx *ctx, int vcpu) { - int error; uint64_t rip; - error = vm_get_register(ctx, vcpu, VM_REG_GUEST_RIP, &rip); - assert(error == 0); + vm_get_register(ctx, vcpu, VM_REG_GUEST_RIP, &rip); fbsdrun_set_capabilities(ctx, vcpu); - error = vm_set_capability(ctx, vcpu, VM_CAP_UNRESTRICTED_GUEST, 1); - assert(error == 0); + vm_set_capability(ctx, vcpu, VM_CAP_UNRESTRICTED_GUEST, 1); fbsdrun_addcpu(ctx, BSP, vcpu, rip); } diff --git a/usr.sbin/bhyve/gdb.c b/usr.sbin/bhyve/gdb.c index 219d192b7c9..0ff15bdef5b 100644 --- a/usr.sbin/bhyve/gdb.c +++ b/usr.sbin/bhyve/gdb.c @@ -780,7 +780,6 @@ static void gdb_cpu_resume(int vcpu) { struct vcpu_state *vs; - int error; vs = &vcpu_state[vcpu]; @@ -791,8 +790,7 @@ gdb_cpu_resume(int vcpu) assert(vs->hit_swbreak == false); assert(vs->stepped == false); if (vs->stepping) { - error = vm_set_capability(ctx, vcpu, VM_CAP_MTRAP_EXIT, 1); - assert(error == 0); + vm_set_capability(ctx, vcpu, VM_CAP_MTRAP_EXIT, 1); } } @@ -874,15 +872,13 @@ gdb_cpu_breakpoint(int vcpu, struct vm_exit *vmexit) struct breakpoint *bp; struct vcpu_state *vs; uint64_t gpa; - int error; if (!gdb_active) { fprintf(stderr, "vm_loop: unexpected VMEXIT_DEBUG\n"); exit(4); } pthread_mutex_lock(&gdb_lock); - error = guest_vaddr2paddr(vcpu, vmexit->rip, &gpa); - assert(error == 1); + guest_vaddr2paddr(vcpu, vmexit->rip, &gpa); bp = find_breakpoint(gpa); if (bp != NULL) { vs = &vcpu_state[vcpu]; @@ -914,11 +910,9 @@ gdb_cpu_breakpoint(int vcpu, struct vm_exit *vmexit) } else { debug("$vCPU %d injecting breakpoint at rip %#lx\n", vcpu, vmexit->rip); - error = vm_set_register(ctx, vcpu, + vm_set_register(ctx, vcpu, VM_REG_GUEST_ENTRY_INST_LENGTH, vmexit->u.bpt.inst_length); - assert(error == 0); - error = vm_inject_exception(ctx, vcpu, IDT_BP, 0, 0, 0); - assert(error == 0); + vm_inject_exception(ctx, vcpu, IDT_BP, 0, 0, 0); } pthread_mutex_unlock(&gdb_lock); } diff --git a/usr.sbin/bhyve/hda_codec.c b/usr.sbin/bhyve/hda_codec.c index 7a6ba345d8e..45dfdc898e7 100644 --- a/usr.sbin/bhyve/hda_codec.c +++ b/usr.sbin/bhyve/hda_codec.c @@ -395,7 +395,6 @@ hda_codec_init(struct hda_codec_inst *hci, const char *play, { struct hda_codec_softc *sc = NULL; struct hda_codec_stream *st = NULL; - int err; if (!(play || rec)) return (-1); @@ -426,10 +425,9 @@ hda_codec_init(struct hda_codec_inst *hci, const char *play, if (play) { st = &sc->streams[HDA_CODEC_STREAM_OUTPUT]; - err = hda_audio_ctxt_init(&st->actx, "hda-audio-output", + hda_audio_ctxt_init(&st->actx, "hda-audio-output", hda_codec_audio_output_do_transfer, hda_codec_audio_output_do_setup, sc); - assert(!err); st->aud = audio_init(play, 1); if (!st->aud) { @@ -444,10 +442,9 @@ hda_codec_init(struct hda_codec_inst *hci, const char *play, if (rec) { st = &sc->streams[HDA_CODEC_STREAM_INPUT]; - err = hda_audio_ctxt_init(&st->actx, "hda-audio-input", + hda_audio_ctxt_init(&st->actx, "hda-audio-input", hda_codec_audio_input_do_transfer, hda_codec_audio_input_do_setup, sc); - assert(!err); st->aud = audio_init(rec, 0); if (!st->aud) { @@ -743,7 +740,6 @@ hda_codec_audio_input_do_transfer(void *arg) struct hda_ops *hops = NULL; struct hda_codec_stream *st = NULL; struct audio *aud = NULL; - int err; hci = sc->hci; assert(hci); @@ -754,8 +750,7 @@ hda_codec_audio_input_do_transfer(void *arg) st = &sc->streams[HDA_CODEC_STREAM_INPUT]; aud = st->aud; - err = audio_record(aud, st->buf, sizeof(st->buf)); - assert(!err); + audio_record(aud, st->buf, sizeof(st->buf)); hops->transfer(hci, st->stream, 0, st->buf, sizeof(st->buf)); } @@ -884,8 +879,6 @@ static int hda_audio_ctxt_init(struct hda_audio_ctxt *actx, const char *tname, transfer_func_t do_transfer, setup_func_t do_setup, void *priv) { - int err; - assert(actx); assert(tname); assert(do_transfer); @@ -903,14 +896,11 @@ hda_audio_ctxt_init(struct hda_audio_ctxt *actx, const char *tname, else strcpy(actx->name, "unknown"); - err = pthread_mutex_init(&actx->mtx, NULL); - assert(!err); + pthread_mutex_init(&actx->mtx, NULL); - err = pthread_cond_init(&actx->cond, NULL); - assert(!err); + pthread_cond_init(&actx->cond, NULL); - err = pthread_create(&actx->tid, NULL, hda_audio_ctxt_thr, actx); - assert(!err); + pthread_create(&actx->tid, NULL, hda_audio_ctxt_thr, actx); pthread_set_name_np(actx->tid, tname); diff --git a/usr.sbin/bhyve/mem.c b/usr.sbin/bhyve/mem.c index 90aefe45c85..588e116c3b1 100644 --- a/usr.sbin/bhyve/mem.c +++ b/usr.sbin/bhyve/mem.c @@ -169,7 +169,7 @@ access_memory(struct vmctx *ctx, int vcpu, uint64_t paddr, mem_cb_t *cb, void *arg) { struct mmio_rb_range *entry; - int err, perror, immutable; + int err, immutable; pthread_rwlock_rdlock(&mmio_rwlock); /* @@ -187,8 +187,7 @@ access_memory(struct vmctx *ctx, int vcpu, uint64_t paddr, mem_cb_t *cb, /* Update the per-vCPU cache */ mmio_hint[vcpu] = entry; } else if (mmio_rb_lookup(&mmio_rb_fallback, paddr, &entry)) { - perror = pthread_rwlock_unlock(&mmio_rwlock); - assert(perror == 0); + pthread_rwlock_unlock(&mmio_rwlock); return (ESRCH); } } @@ -208,15 +207,13 @@ access_memory(struct vmctx *ctx, int vcpu, uint64_t paddr, mem_cb_t *cb, */ immutable = (entry->mr_param.flags & MEM_F_IMMUTABLE); if (immutable) { - perror = pthread_rwlock_unlock(&mmio_rwlock); - assert(perror == 0); + pthread_rwlock_unlock(&mmio_rwlock); } err = cb(ctx, vcpu, paddr, &entry->mr_param, arg); if (!immutable) { - perror = pthread_rwlock_unlock(&mmio_rwlock); - assert(perror == 0); + pthread_rwlock_unlock(&mmio_rwlock); } @@ -294,7 +291,7 @@ static int register_mem_int(struct mmio_rb_tree *rbt, struct mem_range *memp) { struct mmio_rb_range *entry, *mrp; - int err, perror; + int err; err = 0; @@ -310,8 +307,7 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_range *memp) pthread_rwlock_wrlock(&mmio_rwlock); if (mmio_rb_lookup(rbt, memp->base, &entry) != 0) err = mmio_rb_add(rbt, mrp); - perror = pthread_rwlock_unlock(&mmio_rwlock); - assert(perror == 0); + pthread_rwlock_unlock(&mmio_rwlock); if (err) free(mrp); } @@ -336,17 +332,12 @@ register_mem_fallback(struct mem_range *memp) int unregister_mem(struct mem_range *memp) { - struct mem_range *mr; struct mmio_rb_range *entry = NULL; - int err, perror, i; + int err, i; pthread_rwlock_wrlock(&mmio_rwlock); err = mmio_rb_lookup(&mmio_rb_root, memp->base, &entry); if (err == 0) { - mr = &entry->mr_param; - assert(mr->name == memp->name); - assert(mr->base == memp->base && mr->size == memp->size); - assert((mr->flags & MEM_F_IMMUTABLE) == 0); RB_REMOVE(mmio_rb_tree, &mmio_rb_root, entry); /* flush Per-vCPU cache */ @@ -355,8 +346,7 @@ unregister_mem(struct mem_range *memp) mmio_hint[i] = NULL; } } - perror = pthread_rwlock_unlock(&mmio_rwlock); - assert(perror == 0); + pthread_rwlock_unlock(&mmio_rwlock); if (entry) free(entry); diff --git a/usr.sbin/bhyve/mevent.c b/usr.sbin/bhyve/mevent.c index 0c5351cd31a..2ce2f655ba6 100644 --- a/usr.sbin/bhyve/mevent.c +++ b/usr.sbin/bhyve/mevent.c @@ -475,7 +475,6 @@ mevent_dispatch(void) { struct kevent changelist[MEVENT_MAX]; struct kevent eventlist[MEVENT_MAX]; - struct mevent *pipev; int numev; int ret; #ifndef WITHOUT_CAPSICUM @@ -509,8 +508,7 @@ mevent_dispatch(void) /* * Add internal event handler for the pipe write fd */ - pipev = mevent_add(mevent_pipefd[0], EVF_READ, mevent_pipe_read, NULL); - assert(pipev != NULL); + mevent_add(mevent_pipefd[0], EVF_READ, mevent_pipe_read, NULL); for (;;) { /* diff --git a/usr.sbin/bhyve/pci_ahci.c b/usr.sbin/bhyve/pci_ahci.c index 38ec87c34ee..d6c301492d4 100644 --- a/usr.sbin/bhyve/pci_ahci.c +++ b/usr.sbin/bhyve/pci_ahci.c @@ -672,7 +672,7 @@ ahci_handle_rw(struct ahci_port *p, int slot, uint8_t *cfis, uint32_t done) struct ahci_cmd_hdr *hdr; uint64_t lba; uint32_t len; - int err, first, ncq, readop; + int first, ncq, readop; prdt = (struct ahci_prdt_entry *)(cfis + 0x80); hdr = (struct ahci_cmd_hdr *)(p->cmd_lst + slot * AHCI_CL_SIZE); @@ -744,10 +744,9 @@ ahci_handle_rw(struct ahci_port *p, int slot, uint8_t *cfis, uint32_t done) ahci_write_fis_d2h_ncq(p, slot); if (readop) - err = blockif_read(p->bctx, breq); + blockif_read(p->bctx, breq); else - err = blockif_write(p->bctx, breq); - assert(err == 0); + blockif_write(p->bctx, breq); } static void @@ -755,7 +754,6 @@ ahci_handle_flush(struct ahci_port *p, int slot, uint8_t *cfis) { struct ahci_ioreq *aior; struct blockif_req *breq; - int err; /* * Pull request off free list @@ -780,8 +778,7 @@ ahci_handle_flush(struct ahci_port *p, int slot, uint8_t *cfis) */ TAILQ_INSERT_HEAD(&p->iobhd, aior, io_blist); - err = blockif_flush(p->bctx, breq); - assert(err == 0); + blockif_flush(p->bctx, breq); } static inline void @@ -820,7 +817,7 @@ ahci_handle_dsm_trim(struct ahci_port *p, int slot, uint8_t *cfis, uint32_t done uint8_t *entry; uint64_t elba; uint32_t len, elen; - int err, first, ncq; + int first, ncq; uint8_t buf[512]; first = (done == 0); @@ -894,8 +891,7 @@ next: if (ncq && first) ahci_write_fis_d2h_ncq(p, slot); - err = blockif_delete(p->bctx, breq); - assert(err == 0); + blockif_delete(p->bctx, breq); } static inline void @@ -1402,7 +1398,6 @@ atapi_read(struct ahci_port *p, int slot, uint8_t *cfis, uint32_t done) uint8_t *acmd; uint64_t lba; uint32_t len; - int err; acmd = cfis + 0x40; hdr = (struct ahci_cmd_hdr *)(p->cmd_lst + slot * AHCI_CL_SIZE); @@ -1441,8 +1436,7 @@ atapi_read(struct ahci_port *p, int slot, uint8_t *cfis, uint32_t done) /* Stuff request onto busy list. */ TAILQ_INSERT_HEAD(&p->iobhd, aior, io_blist); - err = blockif_read(p->bctx, breq); - assert(err == 0); + blockif_read(p->bctx, breq); } static void diff --git a/usr.sbin/bhyve/pci_e82545.c b/usr.sbin/bhyve/pci_e82545.c index d0b4fb9e466..7688cbc205b 100644 --- a/usr.sbin/bhyve/pci_e82545.c +++ b/usr.sbin/bhyve/pci_e82545.c @@ -1084,7 +1084,7 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head, uint16_t tail, struct ck_info ckinfo[2]; struct iovec *iov; union e1000_tx_udesc *dsc; - int desc, dtype, len, ntype, iovcnt, tlen, tcp, tso; + int desc, dtype, len, iovcnt, tcp, tso; int mss, paylen, seg, tiovcnt, left, now, nleft, nnow, pv, pvoff; unsigned hdrlen, vlen; uint32_t tcpsum, tcpseq; @@ -1092,8 +1092,6 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head, uint16_t tail, ckinfo[0].ck_valid = ckinfo[1].ck_valid = 0; iovcnt = 0; - tlen = 0; - ntype = 0; tso = 0; ohead = head; @@ -1124,20 +1122,17 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head, uint16_t tail, /* * legacy cksum start valid in first descriptor */ - ntype = dtype; ckinfo[0].ck_start = dsc->td.upper.fields.css; break; case E1000_TXD_TYP_D: DPRINTF("tx data desc idx %d: %08x%08x", head, dsc->td.upper.data, dsc->td.lower.data); - ntype = dtype; break; default: break; } } else { /* Descriptor type must be consistent */ - assert(dtype == ntype); DPRINTF("tx next desc idx %d: %08x%08x", head, dsc->td.upper.data, dsc->td.lower.data); } @@ -1150,7 +1145,6 @@ e82545_transmit(struct e82545_softc *sc, uint16_t head, uint16_t tail, if ((dsc->td.lower.data & E1000_TXD_CMD_EOP) != 0 && (dsc->td.lower.data & E1000_TXD_CMD_IFCS) == 0) len -= 2; - tlen += len; if (iovcnt < I82545_MAX_TXSEGS) { iov[iovcnt].iov_base = paddr_guest2host( sc->esc_ctx, dsc->td.buffer_addr, len); diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index d155029d269..aca69cbf88f 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -507,7 +507,6 @@ static void modify_bar_registration(struct pci_devinst *pi, int idx, int registration) { struct pci_devemu *pe; - int error; struct inout_port iop; struct mem_range mr; @@ -522,9 +521,9 @@ modify_bar_registration(struct pci_devinst *pi, int idx, int registration) iop.flags = IOPORT_F_INOUT; iop.handler = pci_emul_io_handler; iop.arg = pi; - error = register_inout(&iop); + register_inout(&iop); } else - error = unregister_inout(&iop); + unregister_inout(&iop); if (pe->pe_baraddr != NULL) (*pe->pe_baraddr)(pi->pi_vmctx, pi, idx, registration, pi->pi_bar[idx].addr); @@ -540,18 +539,14 @@ modify_bar_registration(struct pci_devinst *pi, int idx, int registration) mr.handler = pci_emul_mem_handler; mr.arg1 = pi; mr.arg2 = idx; - error = register_mem(&mr); + register_mem(&mr); } else - error = unregister_mem(&mr); + unregister_mem(&mr); if (pe->pe_baraddr != NULL) (*pe->pe_baraddr)(pi->pi_vmctx, pi, idx, registration, pi->pi_bar[idx].addr); break; - default: - error = EINVAL; - break; } - assert(error == 0); } static void @@ -2253,7 +2248,6 @@ struct pci_emul_dsoftc { static int pci_emul_dinit(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) { - int error; struct pci_emul_dsoftc *sc; sc = calloc(1, sizeof(struct pci_emul_dsoftc)); @@ -2264,17 +2258,13 @@ pci_emul_dinit(struct vmctx *ctx, struct pci_devinst *pi, nvlist_t *nvl) pci_set_cfgdata16(pi, PCIR_VENDOR, 0x10DD); pci_set_cfgdata8(pi, PCIR_CLASS, 0x02); - error = pci_emul_add_msicap(pi, PCI_EMUL_MSI_MSGS); - assert(error == 0); + pci_emul_add_msicap(pi, PCI_EMUL_MSI_MSGS); - error = pci_emul_alloc_bar(pi, 0, PCIBAR_IO, DIOSZ); - assert(error == 0); + pci_emul_alloc_bar(pi, 0, PCIBAR_IO, DIOSZ); - error = pci_emul_alloc_bar(pi, 1, PCIBAR_MEM32, DMEMSZ); - assert(error == 0); + pci_emul_alloc_bar(pi, 1, PCIBAR_MEM32, DMEMSZ); - error = pci_emul_alloc_bar(pi, 2, PCIBAR_MEM32, DMEMSZ); - assert(error == 0); + pci_emul_alloc_bar(pi, 2, PCIBAR_MEM32, DMEMSZ); return (0); } diff --git a/usr.sbin/bhyve/pci_hda.c b/usr.sbin/bhyve/pci_hda.c index 7491944fedd..d8677088301 100644 --- a/usr.sbin/bhyve/pci_hda.c +++ b/usr.sbin/bhyve/pci_hda.c @@ -325,7 +325,6 @@ hda_init(nvlist_t *nvl) const char *value; char *play; char *rec; - int err; #if DEBUG_HDA == 1 dbg = fopen("/tmp/bhyve_hda.log", "w+"); @@ -355,8 +354,7 @@ hda_init(nvlist_t *nvl) rec = strdup(value); DPRINTF("play: %s rec: %s", play, rec); if (play != NULL || rec != NULL) { - err = hda_codec_constructor(sc, codec, play, rec); - assert(!err); + hda_codec_constructor(sc, codec, play, rec); } free(play); free(rec); @@ -786,7 +784,6 @@ hda_corb_run(struct hda_softc *sc) { struct hda_codec_cmd_ctl *corb = &sc->corb; uint32_t verb = 0; - int err; corb->wp = hda_get_reg_by_offset(sc, HDAC_CORBWP); @@ -797,8 +794,7 @@ hda_corb_run(struct hda_softc *sc) verb = hda_dma_ld_dword(corb->dma_vaddr + \ HDA_CORB_ENTRY_LEN * corb->rp); - err = hda_send_command(sc, verb); - assert(!err); + hda_send_command(sc, verb); } hda_set_reg_by_offset(sc, HDAC_CORBRP, corb->rp); @@ -923,13 +919,11 @@ static void hda_set_corbctl(struct hda_softc *sc, uint32_t offset, uint32_t old) { uint32_t value = hda_get_reg_by_offset(sc, offset); - int err; struct hda_codec_cmd_ctl *corb = NULL; if (value & HDAC_CORBCTL_CORBRUN) { if (!(old & HDAC_CORBCTL_CORBRUN)) { - err = hda_corb_start(sc); - assert(!err); + hda_corb_start(sc); } } else { corb = &sc->corb; @@ -943,12 +937,10 @@ static void hda_set_rirbctl(struct hda_softc *sc, uint32_t offset, uint32_t old) { uint32_t value = hda_get_reg_by_offset(sc, offset); - int err; struct hda_codec_cmd_ctl *rirb = NULL; if (value & HDAC_RIRBCTL_RIRBDMAEN) { - err = hda_rirb_start(sc); - assert(!err); + hda_rirb_start(sc); } else { rirb = &sc->rirb; memset(rirb, 0, sizeof(*rirb)); @@ -1005,7 +997,6 @@ hda_set_sdctl(struct hda_softc *sc, uint32_t offset, uint32_t old) { uint8_t stream_ind = hda_get_stream_by_offsets(offset, HDAC_SDCTL0); uint32_t value = hda_get_reg_by_offset(sc, offset); - int err; DPRINTF("stream_ind: 0x%x old: 0x%x value: 0x%x", stream_ind, old, value); @@ -1016,11 +1007,9 @@ hda_set_sdctl(struct hda_softc *sc, uint32_t offset, uint32_t old) if ((value & HDAC_SDCTL_RUN) != (old & HDAC_SDCTL_RUN)) { if (value & HDAC_SDCTL_RUN) { - err = hda_stream_start(sc, stream_ind); - assert(!err); + hda_stream_start(sc, stream_ind); } else { - err = hda_stream_stop(sc, stream_ind); - assert(!err); + hda_stream_stop(sc, stream_ind); } } } @@ -1212,10 +1201,8 @@ hda_set_pib(struct hda_softc *sc, uint8_t stream_ind, uint32_t pib) static uint64_t hda_get_clock_ns(void) { struct timespec ts; - int err; - err = clock_gettime(CLOCK_MONOTONIC, &ts); - assert(!err); + clock_gettime(CLOCK_MONOTONIC, &ts); return (ts.tv_sec * 1000000000LL + ts.tv_nsec); } @@ -1261,7 +1248,6 @@ pci_hda_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx, uint64_t offset, int size, uint64_t value) { struct hda_softc *sc = pi->pi_arg; - int err; assert(sc); assert(baridx == 0); @@ -1269,8 +1255,7 @@ pci_hda_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, DPRINTF("offset: 0x%lx value: 0x%lx", offset, value); - err = hda_write(sc, offset, size, value); - assert(!err); + hda_write(sc, offset, size, value); } static uint64_t diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c index 385b812be84..946fa4d3a67 100644 --- a/usr.sbin/bhyve/pci_virtio_block.c +++ b/usr.sbin/bhyve/pci_virtio_block.c @@ -305,7 +305,6 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vqueue_info *vq) struct virtio_blk_hdr *vbh; struct pci_vtblk_ioreq *io; int i, n; - int err; ssize_t iolen; int writeop, type; struct vi_req req; @@ -363,10 +362,10 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vqueue_info *vq) switch (type) { case VBH_OP_READ: - err = blockif_read(sc->bc, &io->io_req); + blockif_read(sc->bc, &io->io_req); break; case VBH_OP_WRITE: - err = blockif_write(sc->bc, &io->io_req); + blockif_write(sc->bc, &io->io_req); break; case VBH_OP_DISCARD: /* @@ -406,11 +405,11 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vqueue_info *vq) io->io_req.br_offset = discard->sector * VTBLK_BSIZE; io->io_req.br_resid = discard->num_sectors * VTBLK_BSIZE; - err = blockif_delete(sc->bc, &io->io_req); + blockif_delete(sc->bc, &io->io_req); break; case VBH_OP_FLUSH: case VBH_OP_FLUSH_OUT: - err = blockif_flush(sc->bc, &io->io_req); + blockif_flush(sc->bc, &io->io_req); break; case VBH_OP_IDENT: /* Assume a single buffer */ @@ -424,7 +423,6 @@ pci_vtblk_proc(struct pci_vtblk_softc *sc, struct vqueue_info *vq) pci_vtblk_done_locked(io, EOPNOTSUPP); return; } - assert(err == 0); } static void diff --git a/usr.sbin/bhyve/pci_virtio_console.c b/usr.sbin/bhyve/pci_virtio_console.c index 71c3375a57a..e22da0357cf 100644 --- a/usr.sbin/bhyve/pci_virtio_console.c +++ b/usr.sbin/bhyve/pci_virtio_console.c @@ -575,15 +575,13 @@ pci_vtcon_control_send(struct pci_vtcon_softc *sc, struct vqueue_info *vq; struct vi_req req; struct iovec iov; - int n; vq = pci_vtcon_port_to_vq(&sc->vsc_control_port, true); if (!vq_has_descs(vq)) return; - n = vq_getchain(vq, &iov, 1, &req); - assert(n == 1); + vq_getchain(vq, &iov, 1, &req); memcpy(iov.iov_base, ctrl, sizeof(struct pci_vtcon_control)); if (payload != NULL && len > 0) @@ -602,14 +600,12 @@ pci_vtcon_notify_tx(void *vsc, struct vqueue_info *vq) struct pci_vtcon_port *port; struct iovec iov[1]; struct vi_req req; - int n; sc = vsc; port = pci_vtcon_vq_to_port(sc, vq); while (vq_has_descs(vq)) { - n = vq_getchain(vq, iov, 1, &req); - assert(n == 1); + vq_getchain(vq, iov, 1, &req); if (port != NULL) port->vsp_cb(port, port->vsp_arg, iov, 1); diff --git a/usr.sbin/bhyve/pci_virtio_net.c b/usr.sbin/bhyve/pci_virtio_net.c index d253b081d13..aad2e133b03 100644 --- a/usr.sbin/bhyve/pci_virtio_net.c +++ b/usr.sbin/bhyve/pci_virtio_net.c @@ -506,7 +506,6 @@ pci_vtnet_tx_thread(void *param) { struct pci_vtnet_softc *sc = param; struct vqueue_info *vq; - int error; vq = &sc->vsc_queues[VTNET_TXQ]; @@ -515,8 +514,7 @@ pci_vtnet_tx_thread(void *param) * first tx signaled */ pthread_mutex_lock(&sc->tx_mtx); - error = pthread_cond_wait(&sc->tx_cond, &sc->tx_mtx); - assert(error == 0); + pthread_cond_wait(&sc->tx_cond, &sc->tx_mtx); for (;;) { /* note - tx mutex is locked here */ @@ -526,8 +524,7 @@ pci_vtnet_tx_thread(void *param) break; sc->tx_in_progress = 0; - error = pthread_cond_wait(&sc->tx_cond, &sc->tx_mtx); - assert(error == 0); + pthread_cond_wait(&sc->tx_cond, &sc->tx_mtx); } vq_kick_disable(vq); sc->tx_in_progress = 1; diff --git a/usr.sbin/bhyve/pci_virtio_rnd.c b/usr.sbin/bhyve/pci_virtio_rnd.c index 7274d0b0591..1d2d6144f94 100644 --- a/usr.sbin/bhyve/pci_virtio_rnd.c +++ b/usr.sbin/bhyve/pci_virtio_rnd.c @@ -114,7 +114,7 @@ pci_vtrnd_notify(void *vsc, struct vqueue_info *vq) struct iovec iov; struct pci_vtrnd_softc *sc; struct vi_req req; - int len, n; + int len; sc = vsc; @@ -124,8 +124,7 @@ pci_vtrnd_notify(void *vsc, struct vqueue_info *vq) } while (vq_has_descs(vq)) { - n = vq_getchain(vq, &iov, 1, &req); - assert(n == 1); + vq_getchain(vq, &iov, 1, &req); len = read(sc->vrsc_fd, iov.iov_base, iov.iov_len); diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index f4a701c0e25..0554fcecb81 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -598,14 +598,12 @@ pci_vtscsi_requestq_notify(void *vsc, struct vqueue_info *vq) struct pci_vtscsi_request *req; struct iovec iov[VTSCSI_MAXSEG]; struct vi_req vireq; - int n; sc = vsc; q = &sc->vss_queues[vq->vq_num - 2]; while (vq_has_descs(vq)) { - n = vq_getchain(vq, iov, VTSCSI_MAXSEG, &vireq); - assert(n >= 1 && n <= VTSCSI_MAXSEG); + vq_getchain(vq, iov, VTSCSI_MAXSEG, &vireq); req = calloc(1, sizeof(struct pci_vtscsi_request)); req->vsr_idx = vireq.idx; diff --git a/usr.sbin/bhyve/pm.c b/usr.sbin/bhyve/pm.c index 9f467cb591e..30357679ffd 100644 --- a/usr.sbin/bhyve/pm.c +++ b/usr.sbin/bhyve/pm.c @@ -63,8 +63,6 @@ static int reset_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, uint32_t *eax, void *arg) { - int error; - static uint8_t reset_control; if (bytes != 1) @@ -76,8 +74,7 @@ reset_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, /* Treat hard and soft resets the same. */ if (reset_control & 0x4) { - error = vm_suspend(ctx, VM_SUSPEND_RESET); - assert(error == 0 || errno == EALREADY); + vm_suspend(ctx, VM_SUSPEND_RESET); } } return (0); @@ -238,8 +235,6 @@ static int pm1_control_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, uint32_t *eax, void *arg) { - int error; - if (bytes != 2) return (-1); if (in) @@ -259,8 +254,7 @@ pm1_control_handler(struct vmctx *ctx, int vcpu, int in, int port, int bytes, */ if (*eax & PM1_SLP_EN) { if ((pm1_control & PM1_SLP_TYP) >> 10 == 5) { - error = vm_suspend(ctx, VM_SUSPEND_POWEROFF); - assert(error == 0 || errno == EALREADY); + vm_suspend(ctx, VM_SUSPEND_POWEROFF); } } } diff --git a/usr.sbin/bhyve/rtc.c b/usr.sbin/bhyve/rtc.c index 0f63156adb9..777c8316492 100644 --- a/usr.sbin/bhyve/rtc.c +++ b/usr.sbin/bhyve/rtc.c @@ -78,7 +78,6 @@ rtc_init(struct vmctx *ctx) { size_t himem; size_t lomem; - int err; /* XXX init diag/reset code/equipment/checksum ? */ @@ -89,21 +88,15 @@ rtc_init(struct vmctx *ctx) * 0x5b/0x5c/0x5d - 64KB chunks above 4GB */ lomem = (vm_get_lowmem_size(ctx) - m_16MB) / m_64KB; - err = vm_rtc_write(ctx, RTC_LMEM_LSB, lomem); - assert(err == 0); - err = vm_rtc_write(ctx, RTC_LMEM_MSB, lomem >> 8); - assert(err == 0); + vm_rtc_write(ctx, RTC_LMEM_LSB, lomem); + vm_rtc_write(ctx, RTC_LMEM_MSB, lomem >> 8); himem = vm_get_highmem_size(ctx) / m_64KB; - err = vm_rtc_write(ctx, RTC_HMEM_LSB, himem); - assert(err == 0); - err = vm_rtc_write(ctx, RTC_HMEM_SB, himem >> 8); - assert(err == 0); - err = vm_rtc_write(ctx, RTC_HMEM_MSB, himem >> 16); - assert(err == 0); - - err = vm_rtc_settime(ctx, rtc_time(ctx)); - assert(err == 0); + vm_rtc_write(ctx, RTC_HMEM_LSB, himem); + vm_rtc_write(ctx, RTC_HMEM_SB, himem >> 8); + vm_rtc_write(ctx, RTC_HMEM_MSB, himem >> 16); + + vm_rtc_settime(ctx, rtc_time(ctx)); } static void diff --git a/usr.sbin/bhyve/spinup_ap.c b/usr.sbin/bhyve/spinup_ap.c index 7c4186f5ed1..7f254f79c53 100644 --- a/usr.sbin/bhyve/spinup_ap.c +++ b/usr.sbin/bhyve/spinup_ap.c @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); static void spinup_ap_realmode(struct vmctx *ctx, int newcpu, uint64_t *rip) { - int vector, error; + int vector; uint16_t cs; uint64_t desc_base; uint32_t desc_limit, desc_access; @@ -59,33 +59,26 @@ spinup_ap_realmode(struct vmctx *ctx, int newcpu, uint64_t *rip) * Update the %cs and %rip of the guest so that it starts * executing real mode code at at 'vector << 12'. */ - error = vm_set_register(ctx, newcpu, VM_REG_GUEST_RIP, *rip); - assert(error == 0); + vm_set_register(ctx, newcpu, VM_REG_GUEST_RIP, *rip); - error = vm_get_desc(ctx, newcpu, VM_REG_GUEST_CS, &desc_base, + vm_get_desc(ctx, newcpu, VM_REG_GUEST_CS, &desc_base, &desc_limit, &desc_access); - assert(error == 0); desc_base = vector << PAGE_SHIFT; - error = vm_set_desc(ctx, newcpu, VM_REG_GUEST_CS, + vm_set_desc(ctx, newcpu, VM_REG_GUEST_CS, desc_base, desc_limit, desc_access); - assert(error == 0); cs = (vector << PAGE_SHIFT) >> 4; - error = vm_set_register(ctx, newcpu, VM_REG_GUEST_CS, cs); - assert(error == 0); + vm_set_register(ctx, newcpu, VM_REG_GUEST_CS, cs); } int spinup_ap(struct vmctx *ctx, int vcpu, int newcpu, uint64_t rip) { - int error; - assert(newcpu != 0); assert(newcpu < guest_ncpus); - error = vcpu_reset(ctx, newcpu); - assert(error == 0); + vcpu_reset(ctx, newcpu); fbsdrun_set_capabilities(ctx, newcpu); @@ -95,8 +88,7 @@ spinup_ap(struct vmctx *ctx, int vcpu, int newcpu, uint64_t rip) * Set up the processor state in power-on 16-bit mode, with the CS:IP * init'd to the specified low-mem 4K page. */ - error = vm_set_capability(ctx, newcpu, VM_CAP_UNRESTRICTED_GUEST, 1); - assert(error == 0); + vm_set_capability(ctx, newcpu, VM_CAP_UNRESTRICTED_GUEST, 1); spinup_ap_realmode(ctx, newcpu, &rip); diff --git a/usr.sbin/bhyve/task_switch.c b/usr.sbin/bhyve/task_switch.c index f1b564d560c..94ade46a18e 100644 --- a/usr.sbin/bhyve/task_switch.c +++ b/usr.sbin/bhyve/task_switch.c @@ -104,20 +104,16 @@ static uint64_t GETREG(struct vmctx *ctx, int vcpu, int reg) { uint64_t val; - int error; - error = vm_get_register(ctx, vcpu, reg, &val); - assert(error == 0); + vm_get_register(ctx, vcpu, reg, &val); return (val); } static void SETREG(struct vmctx *ctx, int vcpu, int reg, uint64_t val) { - int error; - error = vm_set_register(ctx, vcpu, reg, val); - assert(error == 0); + vm_set_register(ctx, vcpu, reg, val); } static struct seg_desc @@ -178,11 +174,10 @@ desc_table_limit_check(struct vmctx *ctx, int vcpu, uint16_t sel) { uint64_t base; uint32_t limit, access; - int error, reg; + int reg; reg = ISLDT(sel) ? VM_REG_GUEST_LDTR : VM_REG_GUEST_GDTR; - error = vm_get_desc(ctx, vcpu, reg, &base, &limit, &access); - assert(error == 0); + vm_get_desc(ctx, vcpu, reg, &base, &limit, &access); if (reg == VM_REG_GUEST_LDTR) { if (SEG_DESC_UNUSABLE(access) || !SEG_DESC_PRESENT(access)) @@ -470,10 +465,7 @@ tss32_save(struct vmctx *ctx, int vcpu, struct vm_task_switch *task_switch, static void update_seg_desc(struct vmctx *ctx, int vcpu, int reg, struct seg_desc *sd) { - int error; - - error = vm_set_desc(ctx, vcpu, reg, sd->base, sd->limit, sd->access); - assert(error == 0); + vm_set_desc(ctx, vcpu, reg, sd->base, sd->limit, sd->access); } /* @@ -714,7 +706,7 @@ vmexit_task_switch(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) struct iovec nt_iov[2], ot_iov[2]; uint64_t cr0, ot_base; uint32_t eip, ot_lim, access; - int error, ext, fault, minlimit, nt_type, ot_type, vcpu; + int error, ext, fault, minlimit, nt_type, vcpu; enum task_switch_reason reason; uint16_t nt_sel, ot_sel; @@ -818,8 +810,6 @@ vmexit_task_switch(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) &access); assert(error == 0); assert(!SEG_DESC_UNUSABLE(access) && SEG_DESC_PRESENT(access)); - ot_type = SEG_DESC_TYPE(access); - assert(ot_type == SDT_SYS386BSY || ot_type == SDT_SYS286BSY); /* Fetch the old TSS descriptor */ error = read_tss_descriptor(ctx, vcpu, task_switch, ot_sel, &ot_desc, diff --git a/usr.sbin/bhyve/uart_emul.c b/usr.sbin/bhyve/uart_emul.c index fd0ad2c846f..3e2f87a16a9 100644 --- a/usr.sbin/bhyve/uart_emul.c +++ b/usr.sbin/bhyve/uart_emul.c @@ -188,7 +188,6 @@ rxfifo_reset(struct uart_softc *sc, int size) char flushbuf[32]; struct fifo *fifo; ssize_t nread; - int error; fifo = &sc->rxfifo; bzero(fifo, sizeof(struct fifo)); @@ -208,8 +207,7 @@ rxfifo_reset(struct uart_softc *sc, int size) * Enable mevent to trigger when new characters are available * on the tty fd. */ - error = mevent_enable(sc->mev); - assert(error == 0); + mevent_enable(sc->mev); } } @@ -226,7 +224,6 @@ static int rxfifo_putchar(struct uart_softc *sc, uint8_t ch) { struct fifo *fifo; - int error; fifo = &sc->rxfifo; @@ -239,8 +236,7 @@ rxfifo_putchar(struct uart_softc *sc, uint8_t ch) /* * Disable mevent callback if the FIFO is full. */ - error = mevent_disable(sc->mev); - assert(error == 0); + mevent_disable(sc->mev); } } return (0); @@ -252,7 +248,7 @@ static int rxfifo_getchar(struct uart_softc *sc) { struct fifo *fifo; - int c, error, wasfull; + int c, wasfull; wasfull = 0; fifo = &sc->rxfifo; @@ -264,8 +260,7 @@ rxfifo_getchar(struct uart_softc *sc) fifo->num--; if (wasfull) { if (sc->tty.opened) { - error = mevent_enable(sc->mev); - assert(error == 0); + mevent_enable(sc->mev); } } return (c); diff --git a/usr.sbin/bhyve/vga.c b/usr.sbin/bhyve/vga.c index 24864f32e8b..1dde97422f9 100644 --- a/usr.sbin/bhyve/vga.c +++ b/usr.sbin/bhyve/vga.c @@ -1270,7 +1270,7 @@ vga_init(int io_only) { struct inout_port iop; struct vga_softc *sc; - int port, error; + int port; sc = calloc(1, sizeof(struct vga_softc)); @@ -1283,8 +1283,7 @@ vga_init(int io_only) iop.handler = vga_port_handler; iop.arg = sc; - error = register_inout(&iop); - assert(error == 0); + register_inout(&iop); } sc->gc_image = console_get_image(); @@ -1299,8 +1298,7 @@ vga_init(int io_only) sc->mr.size = 128 * KB; sc->mr.handler = vga_mem_handler; sc->mr.arg1 = sc; - error = register_mem_fallback(&sc->mr); - assert(error == 0); + register_mem_fallback(&sc->mr); sc->vga_ram = malloc(256 * KB); memset(sc->vga_ram, 0, 256 * KB); diff --git a/usr.sbin/bsdinstall/partedit/scripted.c b/usr.sbin/bsdinstall/partedit/scripted.c index 37ac6de131b..ae275663917 100644 --- a/usr.sbin/bsdinstall/partedit/scripted.c +++ b/usr.sbin/bsdinstall/partedit/scripted.c @@ -71,12 +71,11 @@ part_config(char *disk, const char *scheme, char *config) struct gclass *classp; struct gmesh mesh; struct ggeom *gpart = NULL; - int error; if (scheme == NULL) scheme = default_scheme(); - error = geom_gettree(&mesh); + geom_gettree(&mesh); if (provider_for_name(&mesh, disk) == NULL) { fprintf(stderr, "GEOM provider %s not found\n", disk); geom_deletetree(&mesh); @@ -107,7 +106,7 @@ part_config(char *disk, const char *scheme, char *config) } geom_deletetree(&mesh); - error = geom_gettree(&mesh); + geom_gettree(&mesh); /* Create partitions */ if (config == NULL) { @@ -133,7 +132,7 @@ part_config(char *disk, const char *scheme, char *config) gpart_create(provider_for_name(&mesh, disk), type, size, mount, NULL, 0); geom_deletetree(&mesh); - error = geom_gettree(&mesh); + geom_gettree(&mesh); size = type = mount = NULL; } diff --git a/usr.sbin/camdd/camdd.c b/usr.sbin/camdd/camdd.c index caf06ba9a59..337c48db6f2 100644 --- a/usr.sbin/camdd/camdd.c +++ b/usr.sbin/camdd/camdd.c @@ -2748,12 +2748,9 @@ bailout: int camdd_get_next_lba_len(struct camdd_dev *dev, uint64_t *lba, ssize_t *len) { - struct camdd_dev_pass *pass_dev; uint32_t num_blocks; int retval = 0; - pass_dev = &dev->dev_spec.pass; - *lba = dev->next_io_pos_bytes / dev->sector_size; *len = dev->blocksize; num_blocks = *len / dev->sector_size; @@ -2810,15 +2807,11 @@ camdd_queue(struct camdd_dev *dev, struct camdd_buf *read_buf) { struct camdd_buf *buf = NULL; struct camdd_buf_data *data; - struct camdd_dev_pass *pass_dev; size_t new_len; struct camdd_buf_data *rb_data; int is_write = dev->write_dev; int eof_flush_needed = 0; int retval = 0; - int error; - - pass_dev = &dev->dev_spec.pass; /* * If we've gotten EOF or our partner has, we should not continue @@ -2838,8 +2831,7 @@ camdd_queue(struct camdd_dev *dev, struct camdd_buf *read_buf) */ if (is_write) { read_buf->status = CAMDD_STATUS_EOF; - - error = camdd_complete_peer_buf(dev, read_buf); + camdd_complete_peer_buf(dev, read_buf); } goto bailout; } @@ -2908,7 +2900,7 @@ camdd_queue(struct camdd_dev *dev, struct camdd_buf *read_buf) if (len == 0) { dev->flags |= CAMDD_DEV_FLAG_EOF; - error = camdd_complete_peer_buf(dev, read_buf); + camdd_complete_peer_buf(dev, read_buf); goto bailout; } } @@ -3560,7 +3552,6 @@ int main(int argc, char **argv) { int c; - camdd_argmask arglist = CAMDD_ARG_NONE; int timeout = 0, retry_count = 1; int error = 0; uint64_t max_io = 0; @@ -3585,10 +3576,8 @@ main(int argc, char **argv) if (retry_count < 0) errx(1, "retry count %d is < 0", retry_count); - arglist |= CAMDD_ARG_RETRIES; break; case 'E': - arglist |= CAMDD_ARG_ERR_RECOVER; break; case 'i': case 'o': @@ -3618,10 +3607,6 @@ main(int argc, char **argv) errx(1, "invalid timeout %d", timeout); /* Convert the timeout from seconds to ms */ timeout *= 1000; - arglist |= CAMDD_ARG_TIMEOUT; - break; - case 'v': - arglist |= CAMDD_ARG_VERBOSE; break; case 'h': default: diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c index 53bc417c4e0..75c8592eb07 100644 --- a/usr.sbin/efibootmgr/efibootmgr.c +++ b/usr.sbin/efibootmgr/efibootmgr.c @@ -996,7 +996,7 @@ report_esp_device(bool do_dp, bool do_unix) char *name, *dev, *relpath, *abspath; uint8_t *walker, *ep; efi_char *descr; - efidp dp, edp; + efidp dp; char buf[PATH_MAX]; if (do_dp && do_unix) @@ -1026,7 +1026,6 @@ report_esp_device(bool do_dp, bool do_unix) // Now we have fplen bytes worth of file path stuff dp = (efidp)walker; walker += fplen; - edp = (efidp)walker; if (walker > ep) errx(1, "malformed boot variable %s", name); if (do_dp) { diff --git a/usr.sbin/efidp/efidp.c b/usr.sbin/efidp/efidp.c index aef154112d6..96769402438 100644 --- a/usr.sbin/efidp/efidp.c +++ b/usr.sbin/efidp/efidp.c @@ -169,14 +169,13 @@ efi_to_unix(void) char buffer[MAXSIZE]; char dpbuf[MAXSIZE]; efidp dp; - size_t dplen; char *walker, *dev, *relpath, *abspath; int rv; dp = (efidp)dpbuf; while (fgets(buffer, sizeof(buffer), stdin)) { walker= trim(buffer); - dplen = efidp_parse_device_path(walker, dp, sizeof(dpbuf)); + efidp_parse_device_path(walker, dp, sizeof(dpbuf)); rv = efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath); if (rv == 0) printf("%s:%s %s\n", dev, relpath, abspath); diff --git a/usr.sbin/fifolog/fifolog_reader/fifolog_reader.c b/usr.sbin/fifolog/fifolog_reader/fifolog_reader.c index 7d6fdbff214..c7485ee23d8 100644 --- a/usr.sbin/fifolog/fifolog_reader/fifolog_reader.c +++ b/usr.sbin/fifolog/fifolog_reader/fifolog_reader.c @@ -54,7 +54,6 @@ Render(void *priv __unused, time_t now, unsigned flag __unused, const unsigned c { static struct tm utc; char buf[128]; - int i; if (now < opt_B || now > opt_E) return; @@ -66,8 +65,7 @@ Render(void *priv __unused, time_t now, unsigned flag __unused, const unsigned c fprintf(fo, "%s\n", p); } else if (opt_T != NULL) { (void)gmtime_r(&now, &utc); - i = strftime(buf, sizeof buf, opt_T, &utc); - assert(i > 0); + strftime(buf, sizeof buf, opt_T, &utc); fprintf(fo, "%s %s\n", buf, p); } else { fprintf(fo, "%12ld %s\n", (long)now, p); diff --git a/usr.sbin/fifolog/lib/fifolog_int.c b/usr.sbin/fifolog/lib/fifolog_int.c index d22bd4745e4..19d61c8b7c5 100644 --- a/usr.sbin/fifolog/lib/fifolog_int.c +++ b/usr.sbin/fifolog/lib/fifolog_int.c @@ -178,7 +178,7 @@ fifolog_int_close(struct fifolog_file **ff) } static void -fifolog_int_file_assert(const struct fifolog_file *ff) +fifolog_int_file_assert(const struct fifolog_file *ff __unused) { CHECK_OBJ_NOTNULL(ff, FIFOLOG_FILE_MAGIC); diff --git a/usr.sbin/fifolog/lib/fifolog_reader.c b/usr.sbin/fifolog/lib/fifolog_reader.c index 1ef6a4e2048..7627dad117d 100644 --- a/usr.sbin/fifolog/lib/fifolog_reader.c +++ b/usr.sbin/fifolog/lib/fifolog_reader.c @@ -59,7 +59,6 @@ fifolog_reader_open(const char *fname) { const char *retval; struct fifolog_reader *fr; - int i; fr = calloc(1, sizeof(*fr)); if (fr == NULL) @@ -74,8 +73,7 @@ fifolog_reader_open(const char *fname) err(1, "Cannot malloc"); fr->olen = fr->ff->recsize * 16; - i = inflateInit(fr->ff->zs); - assert(i == Z_OK); + inflateInit(fr->ff->zs); fr->magic = FIFOLOG_READER_MAGIC; return (fr); diff --git a/usr.sbin/fifolog/lib/fifolog_write_poll.c b/usr.sbin/fifolog/lib/fifolog_write_poll.c index cffe095d4d7..a581df6fbc6 100644 --- a/usr.sbin/fifolog/lib/fifolog_write_poll.c +++ b/usr.sbin/fifolog/lib/fifolog_write_poll.c @@ -65,7 +65,7 @@ const char *fifolog_write_statnames[] = { * Check that everything is all right */ static void -fifolog_write_assert(const struct fifolog_writer *f) +fifolog_write_assert(const struct fifolog_writer *f __unused) { CHECK_OBJ_NOTNULL(f, FIFOLOG_WRITER_MAGIC); diff --git a/usr.sbin/fifolog/lib/getdate.y b/usr.sbin/fifolog/lib/getdate.y index 53a515c4d17..02357b24c56 100644 --- a/usr.sbin/fifolog/lib/getdate.y +++ b/usr.sbin/fifolog/lib/getdate.y @@ -816,26 +816,15 @@ yylex(void) time_t get_date(char *p) { - struct tm *tm, gmt; + struct tm *tm; time_t Start; time_t tod; time_t nowtime; - struct tm *gmt_ptr; yyInput = p; (void)time (&nowtime); - gmt_ptr = gmtime (&nowtime); - if (gmt_ptr != NULL) - { - /* Make a copy, in case localtime modifies *tm (I think - that comment now applies to *gmt_ptr, but I am too - lazy to dig into how gmtime and locatime allocate the - structures they return pointers to). */ - gmt = *gmt_ptr; - } - if (! (tm = localtime (&nowtime))) return -1; diff --git a/usr.sbin/fwcontrol/fwdv.c b/usr.sbin/fwcontrol/fwdv.c index 2baf1c43c80..cb821891821 100644 --- a/usr.sbin/fwcontrol/fwdv.c +++ b/usr.sbin/fwcontrol/fwdv.c @@ -262,7 +262,7 @@ dvsend(int d, const char *filename, char ich, int count) struct dvdbc *dv; struct fw_pkt *pkt; int len, tlen, header, fd, frames, packets, vec, offset, nhdr, i; - int system=-1, pad_acc, cycle_acc, cycle, f_cycle, f_frac; + int system=-1, pad_acc, cycle_acc, cycle, f_frac; struct iovec wbuf[TNBUF*2 + NEMPTY]; char *pbuf; u_int32_t iso_data, iso_empty, hdr[TNBUF + NEMPTY][3]; @@ -363,10 +363,10 @@ next: if (frames % frame_rate[system] == 0) fprintf(stderr, "\n"); fflush(stderr); - f_cycle = (cycle_acc / frame_cycle[system].d) & 0xf; f_frac = (cycle_acc % frame_cycle[system].d * CYCLE_FRAC) / frame_cycle[system].d; #if 0 + int f_cycle = (cycle_acc / frame_cycle[system].d) & 0xf; ciph->fdf.dv.cyc = htons(f_cycle << 12 | f_frac); #else ciph->fdf.dv.cyc = htons(cycle << 12 | f_frac); diff --git a/usr.sbin/makefs/msdos.c b/usr.sbin/makefs/msdos.c index a0e0f7174f2..23fa200d3e5 100644 --- a/usr.sbin/makefs/msdos.c +++ b/usr.sbin/makefs/msdos.c @@ -149,7 +149,6 @@ msdos_makefs(const char *image, const char *dir, fsnode *root, fsinfo_t *fsopts) struct vnode vp, rootvp; struct timeval start; struct msdosfsmount *pmp; - uint32_t flags; assert(image != NULL); assert(dir != NULL); @@ -183,7 +182,6 @@ msdos_makefs(const char *image, const char *dir, fsnode *root, fsinfo_t *fsopts) fsopts->fd = open(image, O_RDWR); vp.fs = fsopts; - flags = 0; if ((pmp = msdosfs_mount(&vp)) == NULL) err(1, "msdosfs_mount"); diff --git a/usr.sbin/makefs/msdos/msdosfs_vfsops.c b/usr.sbin/makefs/msdos/msdosfs_vfsops.c index 4a5c658b794..fa4855597d7 100644 --- a/usr.sbin/makefs/msdos/msdosfs_vfsops.c +++ b/usr.sbin/makefs/msdos/msdosfs_vfsops.c @@ -87,7 +87,6 @@ msdosfs_mount(struct vnode *devvp) struct byte_bpb710 *b710; uint8_t SecPerClust; int ronly = 0, error; - int bsize; unsigned secsize = 512; MSDOSFS_DPRINTF(("%s(bread 0)\n", __func__)); @@ -107,7 +106,6 @@ msdosfs_mount(struct vnode *devvp) error = EINVAL; goto error_exit; } - bsize = 0; pmp = ecalloc(1, sizeof(*pmp)); /* diff --git a/usr.sbin/mpsutil/mps_debug.c b/usr.sbin/mpsutil/mps_debug.c index 4c462ef65f6..83315090d73 100644 --- a/usr.sbin/mpsutil/mps_debug.c +++ b/usr.sbin/mpsutil/mps_debug.c @@ -136,11 +136,9 @@ print_sgl(char *buf, int offset, int numframes) { MPI2_SGE_SIMPLE64 *sge; MPI2_SGE_CHAIN_UNION *sgc; - MPI2_REQUEST_HEADER *req; u_int i = 0, flags; char *frame, tmpbuf[128]; - req = (MPI2_REQUEST_HEADER *)buf; frame = (char *)buf; sge = (MPI2_SGE_SIMPLE64 *)&frame[offset * 4]; printf("SGL for command\n"); diff --git a/usr.sbin/mptable/mptable.c b/usr.sbin/mptable/mptable.c index 6c5efee766b..e8be110dfb1 100644 --- a/usr.sbin/mptable/mptable.c +++ b/usr.sbin/mptable/mptable.c @@ -530,7 +530,6 @@ MPConfigTableHeader( u_int32_t pap ) { mpcth_t cth; int x; - int totalSize; int c; int oldtype, entrytype; u_int8_t *entry; @@ -574,8 +573,6 @@ MPConfigTableHeader( u_int32_t pap ) printf( " extended table length:\t%d\n", cth->extended_table_length ); printf( " extended table checksum:\t%d\n", cth->extended_table_checksum ); - totalSize = cth->base_table_length - sizeof( struct MPCTH ); - puts( SEP_LINE ); printf( "MP Config Base Table Entries:\n\n" ); diff --git a/usr.sbin/pmc/cmd_pmc_filter.cc b/usr.sbin/pmc/cmd_pmc_filter.cc index 07027cb272f..7f2fae6d208 100644 --- a/usr.sbin/pmc/cmd_pmc_filter.cc +++ b/usr.sbin/pmc/cmd_pmc_filter.cc @@ -208,7 +208,7 @@ pmc_filter_handler(uint32_t *lwplist, int lwpcount, uint32_t *pidlist, int pidco char cpuid[PMC_CPUID_LEN]; char *proclist[LIST_MAX]; char *threadlist[LIST_MAX]; - int i, pmccount, copies, eventcount; + int i, pmccount, eventcount; int proccount, threadcount; uint32_t idx; idmap pidmap, tidmap; @@ -247,7 +247,6 @@ pmc_filter_handler(uint32_t *lwplist, int lwpcount, uint32_t *pidlist, int pidco pmclog_close(ps); if ((ps = static_cast < struct pmclog_parse_state *>(pmclog_open(infd)))== NULL) errx(EX_OSERR, "ERROR: Cannot allocate pmclog parse state: %s\n", strerror(errno)); - copies = 0; while (pmclog_read(ps, &ev) == 0) { if (ev.pl_type == PMCLOG_TYPE_THR_CREATE) tidmap[ev.pl_u.pl_tc.pl_tid] = ev.pl_u.pl_tc.pl_tdname; diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index 2eec317b5e5..5041dd74b5c 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -493,7 +493,6 @@ pw_pwcrypt(char *password) char salt[SALTSIZE + 1]; char *cryptpw; static char buf[256]; - size_t pwlen; /* * Calculate a salt value @@ -505,8 +504,7 @@ pw_pwcrypt(char *password) cryptpw = crypt(password, salt); if (cryptpw == NULL) errx(EX_CONFIG, "crypt(3) failure"); - pwlen = strlcpy(buf, cryptpw, sizeof(buf)); - assert(pwlen < sizeof(buf)); + strlcpy(buf, cryptpw, sizeof(buf)); return (buf); } diff --git a/usr.sbin/rpc.lockd/kern.c b/usr.sbin/rpc.lockd/kern.c index 08566a5b465..b25ca828fa2 100644 --- a/usr.sbin/rpc.lockd/kern.c +++ b/usr.sbin/rpc.lockd/kern.c @@ -572,16 +572,11 @@ void show(LOCKD_MSG *mp) { static char hex[] = "0123456789abcdef"; - struct fid *fidp; - fsid_t *fsidp; size_t len; u_int8_t *p, *t, buf[NFS_SMALLFH*3+1]; syslog(LOG_DEBUG, "process ID: %lu\n", (long)mp->lm_msg_ident.pid); - fsidp = (fsid_t *)&mp->lm_fh; - fidp = (struct fid *)((u_int8_t *)&mp->lm_fh + sizeof(fsid_t)); - for (t = buf, p = (u_int8_t *)mp->lm_fh, len = mp->lm_fh_len; len > 0; ++p, --len) { diff --git a/usr.sbin/rpc.tlsservd/rpc.tlsservd.c b/usr.sbin/rpc.tlsservd/rpc.tlsservd.c index 71787b162ac..db829be6833 100644 --- a/usr.sbin/rpc.tlsservd/rpc.tlsservd.c +++ b/usr.sbin/rpc.tlsservd/rpc.tlsservd.c @@ -142,7 +142,7 @@ main(int argc, char **argv) * TLS handshake. */ struct sockaddr_un sun; - int ch, debug, fd, oldmask; + int ch, fd, oldmask; SVCXPRT *xprt; struct timeval tm; struct timezone tz; @@ -177,7 +177,6 @@ main(int argc, char **argv) rpctls_dnsname = hostname; } - debug = 0; rpctls_verbose = false; while ((ch = getopt_long(argc, argv, "D:dhl:n:mp:r:uvWw", longopts, NULL)) != -1) { diff --git a/usr.sbin/rrenumd/parser.y b/usr.sbin/rrenumd/parser.y index 43d08634d43..c75dde23df3 100644 --- a/usr.sbin/rrenumd/parser.y +++ b/usr.sbin/rrenumd/parser.y @@ -335,10 +335,8 @@ rrenum_statement: match_prefix_definition: rrenum_cmd MATCH_PREFIX_CMD prefixval maxlen minlen { - struct icmp6_router_renum *irr; struct rr_pco_match *rpm; - irr = &ple_cur.pl_irr; rpm = &ple_cur.pl_rpm; memset(rpm, 0, sizeof(*rpm)); --MP_/wQ+F2DVnjFSjsXA5CnSTh.G--