From d557216fb547c13bfc5427231709ef29494c5f38 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Thu, 20 Aug 2009 10:24:58 -0700 Subject: [PATCH] Fix numerous compiler warnings and format conversion specifiers. --- include/strings.h | 2 + sys/bus/cam/cam.c | 2 +- sys/bus/cam/scsi/scsi_all.c | 4 +- sys/bus/cam/scsi/scsi_target.c | 2 +- sys/bus/usb/usb.c | 2 +- sys/contrib/dev/acpica-unix/executer/exdump.c | 5 ++- .../dev/acpica-unix/namespace/nsutils.c | 2 +- sys/contrib/ipfilter/netinet/ip_state.c | 6 +-- sys/ddb/db_command.c | 1 + sys/dev/disk/nata/ata-all.c | 6 +++ sys/dev/misc/lpt/lpt.c | 2 +- sys/dev/misc/psm/psm.c | 2 + sys/dev/netif/de/if_de.c | 8 +++- sys/dev/raid/ciss/ciss.c | 3 ++ sys/dev/raid/vinum/vinumrequest.c | 9 ++-- sys/dev/serial/dgb/dgm.c | 2 +- sys/dev/sound/usb/uaudio.c | 1 + sys/dev/video/fb/vga.c | 4 +- sys/dev/video/i386/vesa/vesa.c | 13 +++--- sys/emulation/linux/i386/linux_ptrace.c | 3 +- sys/emulation/ndis/subr_ntoskrnl.c | 28 +++++++----- sys/kern/kern_descrip.c | 2 +- sys/kern/tty.c | 6 ++- sys/kern/uipc_syscalls.c | 2 - sys/kern/vfs_bio.c | 6 +-- sys/libkern/bsearch.c | 2 +- sys/net/pf/pf.c | 5 +++ sys/net/tap/if_tap.c | 2 +- sys/netinet6/ah_output.c | 2 + sys/netinet6/ip6_input.c | 2 +- sys/netproto/ipx/ipx_pcb.h | 2 +- sys/netproto/ipx/ipx_var.h | 2 +- sys/opencrypto/cast.c | 9 +++- sys/platform/pc32/apic/mpapic.c | 2 +- sys/platform/pc32/i386/machdep.c | 1 - sys/platform/pc32/i386/mp_machdep.c | 2 +- sys/platform/pc32/i386/pmap.c | 43 +++++++++++-------- sys/platform/pc32/i386/trap.c | 2 +- sys/platform/vkernel/i386/trap.c | 2 +- sys/platform/vkernel/platform/pmap.c | 2 +- sys/sys/libkern.h | 2 +- sys/vfs/nfs/nfs_serv.c | 3 ++ sys/vfs/nfs/nfs_socket.c | 6 +++ sys/vfs/nfs/nfs_syscalls.c | 6 +++ sys/vfs/udf/udf_vnops.c | 4 +- 45 files changed, 142 insertions(+), 82 deletions(-) diff --git a/include/strings.h b/include/strings.h index cf39da74ba..7c90b8904f 100644 --- a/include/strings.h +++ b/include/strings.h @@ -47,8 +47,10 @@ int ffs(int) __pure2; #ifdef __BSD_VISIBLE int ffsl(long) __pure2; int ffsll(long long) __pure2; +#if !defined(_KERNEL_VIRTUAL) int fls(int) __pure2; int flsl(long) __pure2; +#endif int flsll(long long) __pure2; #endif #if !defined(_KERNEL_VIRTUAL) diff --git a/sys/bus/cam/cam.c b/sys/bus/cam/cam.c index 920070cc8e..43c92283d0 100644 --- a/sys/bus/cam/cam.c +++ b/sys/bus/cam/cam.c @@ -182,7 +182,7 @@ const struct cam_status_entry* cam_fetch_status_entry(cam_status status) { status &= CAM_STATUS_MASK; - return (bsearch(&status, &cam_status_table, + return (kbsearch(&status, &cam_status_table, num_cam_status_entries, sizeof(*cam_status_table), camstatusentrycomp)); diff --git a/sys/bus/cam/scsi/scsi_all.c b/sys/bus/cam/scsi/scsi_all.c index 431976fb6e..0a6075d6f9 100644 --- a/sys/bus/cam/scsi/scsi_all.c +++ b/sys/bus/cam/scsi/scsi_all.c @@ -2754,7 +2754,7 @@ fetchtableentries(int sense_key, int asc, int ascq, for (i = 0; i < num_asc_tables; i++) { void *found_entry; - found_entry = bsearch(&asc_ascq, asc_tables[i], + found_entry = kbsearch(&asc_ascq, asc_tables[i], asc_tables_size[i], sizeof(**asc_tables), ascentrycomp); @@ -2768,7 +2768,7 @@ fetchtableentries(int sense_key, int asc, int ascq, for (i = 0; i < num_sense_tables; i++) { void *found_entry; - found_entry = bsearch(&sense_key, sense_tables[i], + found_entry = kbsearch(&sense_key, sense_tables[i], sense_tables_size[i], sizeof(**sense_tables), senseentrycomp); diff --git a/sys/bus/cam/scsi/scsi_target.c b/sys/bus/cam/scsi/scsi_target.c index 8494369fee..afdc59667e 100644 --- a/sys/bus/cam/scsi/scsi_target.c +++ b/sys/bus/cam/scsi/scsi_target.c @@ -565,7 +565,7 @@ targwrite(struct dev_write_args *ap) softc = (struct targ_softc *)ap->a_head.a_dev->si_drv1; write_len = error = 0; CAM_DEBUG(softc->path, CAM_DEBUG_PERIPH, - ("write - uio_resid %ld\n", uio->uio_resid)); + ("write - uio_resid %zu\n", uio->uio_resid)); while (uio->uio_resid >= sizeof(user_ccb) && error == 0) { union ccb *ccb; diff --git a/sys/bus/usb/usb.c b/sys/bus/usb/usb.c index 3194b03497..0a3414fbd3 100644 --- a/sys/bus/usb/usb.c +++ b/sys/bus/usb/usb.c @@ -623,7 +623,7 @@ usbioctl(struct dev_ioctl_args *ap) usbd_status err; int error = 0; - DPRINTF(("usbioctl: USB_REQUEST addr=%d len=%ld\n", addr, len)); + DPRINTF(("usbioctl: USB_REQUEST addr=%d len=%zu\n", addr, len)); if (len > 32768) return (EINVAL); if (addr < 0 || addr >= USB_MAX_DEVICES || diff --git a/sys/contrib/dev/acpica-unix/executer/exdump.c b/sys/contrib/dev/acpica-unix/executer/exdump.c index d7745e7dc5..5078f250ad 100644 --- a/sys/contrib/dev/acpica-unix/executer/exdump.c +++ b/sys/contrib/dev/acpica-unix/executer/exdump.c @@ -424,6 +424,7 @@ AcpiExDumpObject ( UINT8 *Target; char *Name; UINT8 Count; + const char *str; if (!Info) @@ -506,8 +507,8 @@ AcpiExDumpObject ( case ACPI_EXD_REFERENCE: - AcpiExOutString ("Class Name", - (char *) AcpiUtGetReferenceName (ObjDesc)); + str = AcpiUtGetReferenceName (ObjDesc); + AcpiExOutString ("Class Name", __DECONST(char *, str)); AcpiExDumpReferenceObj (ObjDesc); break; diff --git a/sys/contrib/dev/acpica-unix/namespace/nsutils.c b/sys/contrib/dev/acpica-unix/namespace/nsutils.c index 1752af3232..4bfb7c38c1 100644 --- a/sys/contrib/dev/acpica-unix/namespace/nsutils.c +++ b/sys/contrib/dev/acpica-unix/namespace/nsutils.c @@ -1048,7 +1048,7 @@ AcpiNsGetNode ( char *InternalPath; - ACPI_FUNCTION_TRACE_PTR (NsGetNode, Pathname); + ACPI_FUNCTION_TRACE_PTR (NsGetNode, __DECONST(char *, Pathname)); if (!Pathname) diff --git a/sys/contrib/ipfilter/netinet/ip_state.c b/sys/contrib/ipfilter/netinet/ip_state.c index 288f9cfb12..a643567f63 100644 --- a/sys/contrib/ipfilter/netinet/ip_state.c +++ b/sys/contrib/ipfilter/netinet/ip_state.c @@ -1147,10 +1147,8 @@ tcphdr_t *tcp; return 1; } -static int fr_matchicmpqueryreply(v, is, icmp, rev) -int v; -ipstate_t *is; -icmphdr_t *icmp; +static int +fr_matchicmpqueryreply(int v, ipstate_t *is, icmphdr_t *icmp, int rev) { if (v == 4) { /* diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index becb3b20df..fba9ec3ccd 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -228,6 +228,7 @@ db_command(struct command **last_cmdp, struct command *cmd_table, boolean_t have_addr = FALSE; int result; + cmd = NULL; t = db_read_token(); if (t == tEOL) { /* empty line repeats last command, at 'next' */ diff --git a/sys/dev/disk/nata/ata-all.c b/sys/dev/disk/nata/ata-all.c index 9675c63fb1..8c7d3fb713 100644 --- a/sys/dev/disk/nata/ata-all.c +++ b/sys/dev/disk/nata/ata-all.c @@ -61,7 +61,9 @@ static struct dev_ops ata_ops = { }; /* prototypes */ +#if 0 static void ata_boot_attach(void); +#endif static device_t ata_add_child(device_t, struct ata_device *, int); static int ata_getparam(struct ata_device *, int); static void bswap(int8_t *, int); @@ -531,6 +533,8 @@ ata_device_ioctl(device_t dev, u_long cmd, caddr_t data) } } +#if 0 + static void ata_boot_attach(void) { @@ -549,6 +553,8 @@ ata_boot_attach(void) rel_mplock(); } +#endif + /* * misc support functions diff --git a/sys/dev/misc/lpt/lpt.c b/sys/dev/misc/lpt/lpt.c index 23ff75ff29..7bc72dc036 100644 --- a/sys/dev/misc/lpt/lpt.c +++ b/sys/dev/misc/lpt/lpt.c @@ -703,7 +703,7 @@ lptread(struct dev_read_args *ap) while (uio->uio_resid) { error = ppb_1284_read(ppbus, PPB_NIBBLE, sc->sc_statbuf, (int)szmin(BUFSTATSIZE, uio->uio_resid), - len); + &len); if (error) goto error; diff --git a/sys/dev/misc/psm/psm.c b/sys/dev/misc/psm/psm.c index 8cf834aa4f..30c440564c 100644 --- a/sys/dev/misc/psm/psm.c +++ b/sys/dev/misc/psm/psm.c @@ -1655,6 +1655,8 @@ psmioctl(struct dev_ioctl_args *ap) int command_byte; int error = 0; + mode.resolution = -1; + /* Perform IOCTL command */ switch (ap->a_cmd) { diff --git a/sys/dev/netif/de/if_de.c b/sys/dev/netif/de/if_de.c index fb48d3a86d..420dcb6807 100644 --- a/sys/dev/netif/de/if_de.c +++ b/sys/dev/netif/de/if_de.c @@ -3309,11 +3309,13 @@ tulip_tx_intr(tulip_softc_t *sc) /* * If nothing left to transmit, disable the timer. * Else if progress, reset the timer back to 2 ticks. + * + * XXX 2 bit field, TXTIMER is 4? */ if (ri->ri_free == ri->ri_max || (sc->tulip_flags & TULIP_TXPROBE_ACTIVE)) sc->tulip_txtimer = 0; else if (xmits > 0) - sc->tulip_txtimer = TULIP_TXTIMER; + sc->tulip_txtimer = (TULIP_TXTIMER & 3); sc->tulip_if.if_opackets += xmits; return descs; } @@ -3609,10 +3611,12 @@ tulip_txput(tulip_softc_t *sc, struct mbuf *m) /* * switch back to the single queueing ifstart. + * + * XXX 2 bit field, TXTIMER is 4? */ sc->tulip_flags &= ~TULIP_WANTTXSTART; if (sc->tulip_txtimer == 0) - sc->tulip_txtimer = TULIP_TXTIMER; + sc->tulip_txtimer = TULIP_TXTIMER & 3; /* * If we want a txstart, there must be not enough space in the diff --git a/sys/dev/raid/ciss/ciss.c b/sys/dev/raid/ciss/ciss.c index e42b0fe262..eb1a2267fb 100644 --- a/sys/dev/raid/ciss/ciss.c +++ b/sys/dev/raid/ciss/ciss.c @@ -3761,6 +3761,7 @@ ciss_print_adapter(struct ciss_softc *sc) ciss_print_request(sc->ciss_request + i); } +#if 0 /* DDB hook */ static void ciss_print0(void) @@ -3776,6 +3777,8 @@ ciss_print0(void) } #endif +#endif + /************************************************************************ * Return a name for a logical drive status value. */ diff --git a/sys/dev/raid/vinum/vinumrequest.c b/sys/dev/raid/vinum/vinumrequest.c index 5235e959fa..a9b7f58456 100644 --- a/sys/dev/raid/vinum/vinumrequest.c +++ b/sys/dev/raid/vinum/vinumrequest.c @@ -637,10 +637,11 @@ bre(struct request *rq, (uintmax_t)sd->sectors, (uintmax_t)bp->b_bio1.bio_offset); log(LOG_DEBUG, - "vinum: stripebase %x, stripeoffset %x, blockoffset %x\n", - stripebase, - stripeoffset, - blockoffset); + "vinum: stripebase 0x%llx, stripeoffset 0x%llx, " + "blockoffset 0x%llx\n", + (long long)stripebase, + (long long)stripeoffset, + (long long)blockoffset); } #endif } diff --git a/sys/dev/serial/dgb/dgm.c b/sys/dev/serial/dgb/dgm.c index 73868320be..c6455a029d 100644 --- a/sys/dev/serial/dgb/dgm.c +++ b/sys/dev/serial/dgb/dgm.c @@ -914,7 +914,7 @@ dgmdetach(device_t dev) FREE(sc->ttys, M_TTYS); if (sc->vmem) { - pmap_unmapdev(sc->vmem, sc->msize); + pmap_unmapdev((vm_offset_t)sc->vmem, sc->msize); sc->vmem = NULL; } diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index 191ca5e227..af486a02a4 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -1636,6 +1636,7 @@ uaudio_process_as(struct uaudio_softc *sc, const char *buf, int *offsp, ai.edesc1 = epdesc1; ai.asf1desc = asf1d; ai.sc_busy = 0; + ai.ifaceh = NULL; uaudio_add_alt(sc, &ai); #ifdef USB_DEBUG if (ai.attributes & UA_SED_FREQ_CONTROL) diff --git a/sys/dev/video/fb/vga.c b/sys/dev/video/fb/vga.c index 57f82b9d08..376ab42774 100644 --- a/sys/dev/video/fb/vga.c +++ b/sys/dev/video/fb/vga.c @@ -1904,8 +1904,8 @@ vga_mmap_buf(video_adapter_t *adp, vm_offset_t offset, int prot) return -1; #if VGA_DEBUG > 0 - kprintf("vga_mmap_buf(): window:0x%x, offset:0x%x\n", - adp->va_info.vi_window, offset); + kprintf("vga_mmap_buf(): window:0x%x, offset:%p\n", + adp->va_info.vi_window, (void *)offset); #endif /* XXX: is this correct? */ diff --git a/sys/dev/video/i386/vesa/vesa.c b/sys/dev/video/i386/vesa/vesa.c index d1b178d779..e383273c74 100644 --- a/sys/dev/video/i386/vesa/vesa.c +++ b/sys/dev/video/i386/vesa/vesa.c @@ -787,13 +787,13 @@ static vm_offset_t vesa_map_buffer(u_int paddr, size_t size) { vm_offset_t vaddr; - u_int off; + size_t off; off = paddr - trunc_page(paddr); vaddr = (vm_offset_t)pmap_mapdev(paddr - off, size + off); #if VESA_DEBUG > 1 - kprintf("vesa_map_buffer: paddr:0x%x vaddr:0x%x size:0x%x off:0x%x\n", - paddr, vaddr, size, off); + kprintf("vesa_map_buffer: paddr:0x%x vaddr:%p size:%zu off:%zu\n", + paddr, (void *)vaddr, size, off); #endif return (vaddr + off); } @@ -802,7 +802,8 @@ static void vesa_unmap_buffer(vm_offset_t vaddr, size_t size) { #if VESA_DEBUG > 1 - kprintf("vesa_unmap_buffer: vaddr:0x%x size:0x%x\n", vaddr, size); + kprintf("vesa_unmap_buffer: vaddr:%p size:%zu\n", + (void *)vaddr, size); #endif pmap_unmapdev(vaddr, size); } @@ -1298,8 +1299,8 @@ static int vesa_mmap(video_adapter_t *adp, vm_offset_t offset, int prot) { #if VESA_DEBUG > 0 - kprintf("vesa_mmap(): window:0x%x, buffer:0x%x, offset:0x%x\n", - adp->va_info.vi_window, adp->va_info.vi_buffer, offset); + kprintf("vesa_mmap(): window:0x%x, buffer:0x%x, offset:0x%lx\n", + adp->va_info.vi_window, adp->va_info.vi_buffer, (long )offset); #endif if ((adp == vesa_adp) && (adp->va_info.vi_flags & V_INFO_LINEAR)) { diff --git a/sys/emulation/linux/i386/linux_ptrace.c b/sys/emulation/linux/i386/linux_ptrace.c index b6c3cc0d8d..9ae3b07c02 100644 --- a/sys/emulation/linux/i386/linux_ptrace.c +++ b/sys/emulation/linux/i386/linux_ptrace.c @@ -310,7 +310,8 @@ sys_linux_ptrace(struct linux_ptrace_args *uap) &uap->sysmsg_iresult); if (error == 0) { map_regs_to_linux(&u.bsd_reg, &r.reg); - error = copyout(&r.reg, uap->data, sizeof(r.reg)); + error = copyout(&r.reg, (void *)uap->data, + sizeof(r.reg)); } break; case PTRACE_SETREGS: diff --git a/sys/emulation/ndis/subr_ntoskrnl.c b/sys/emulation/ndis/subr_ntoskrnl.c index 750c6147a4..707bceccf8 100644 --- a/sys/emulation/ndis/subr_ntoskrnl.c +++ b/sys/emulation/ndis/subr_ntoskrnl.c @@ -540,6 +540,9 @@ ntoskrnl_waitforobjs(uint32_t cnt, nt_dispatch_header *obj[], else w = wb_array; + tv.tv_sec = 0; /* fix compiler warning */ + tv.tv_usec = 0; /* fix compiler warning */ + /* First pass: see if we can satisfy any waits immediately. */ for (i = 0; i < cnt; i++) { @@ -580,16 +583,16 @@ ntoskrnl_waitforobjs(uint32_t cnt, nt_dispatch_header *obj[], wcnt++; } - if (duetime != NULL) { + if (duetime) { if (*duetime < 0) { - tv.tv_sec = - (*duetime) / 10000000; - tv.tv_usec = (- (*duetime) / 10) - - (tv.tv_sec * 1000000); + tv.tv_sec = -*duetime / 10000000; + tv.tv_usec = (-*duetime / 10) - (tv.tv_sec * 1000000); } else { ntoskrnl_time(&curtime); - if (*duetime < curtime) - tv.tv_sec = tv.tv_usec = 0; - else { + if (*duetime < curtime) { + tv.tv_sec = 0; + tv.tv_usec = 0; + } else { tv.tv_sec = ((*duetime) - curtime) / 10000000; tv.tv_usec = ((*duetime) - curtime) / 10 - (tv.tv_sec * 1000000); @@ -601,9 +604,12 @@ ntoskrnl_waitforobjs(uint32_t cnt, nt_dispatch_header *obj[], nanotime(&t1); lwkt_reltoken(&tokref); - ticks = 1 + tv.tv_sec * hz + tv.tv_usec * hz / 1000000; - - error = ndis_thsuspend(td, duetime == NULL ? 0 : ticks); + if (duetime) { + ticks = 1 + tv.tv_sec * hz + tv.tv_usec * hz / 1000000; + error = ndis_thsuspend(td, ticks); + } else { + error = ndis_thsuspend(td, 0); + } lwkt_gettoken(&tokref, &ntoskrnl_dispatchtoken); nanotime(&t2); @@ -629,7 +635,7 @@ ntoskrnl_waitforobjs(uint32_t cnt, nt_dispatch_header *obj[], if (error || wtype == WAITTYPE_ANY) break; - if (duetime != NULL) { + if (duetime) { tv.tv_sec -= (t2.tv_sec - t1.tv_sec); tv.tv_usec -= (t2.tv_nsec - t1.tv_nsec) / 1000; } diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index f6ced0f9a5..58c7736ca4 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -956,7 +956,7 @@ sys_fpathconf(struct fpathconf_args *uap) case DTYPE_FIFO: case DTYPE_VNODE: vp = (struct vnode *)fp->f_data; - error = VOP_PATHCONF(vp, uap->name, uap->sysmsg_fds); + error = VOP_PATHCONF(vp, uap->name, &uap->sysmsg_reg); break; default: error = EOPNOTSUPP; diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 3201a2c906..197928934d 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1597,6 +1597,8 @@ ttread(struct tty *tp, struct uio *uio, int flag) struct timeval stime; lp = curthread->td_lwp; + stime.tv_sec = 0; /* fix compiler warnings */ + stime.tv_usec = 0; loop: crit_enter(); @@ -1681,7 +1683,7 @@ loop: if (qp->c_cc >= m) goto read; getmicrotime(&timecopy); - if (!has_stime) { + if (has_stime == 0) { /* first character, start timer */ has_stime = 1; stime = timecopy; @@ -1701,7 +1703,7 @@ loop: if (qp->c_cc > 0) goto read; getmicrotime(&timecopy); - if (!has_stime) { + if (has_stime == 0) { has_stime = 1; stime = timecopy; slp = t; diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index f1e868f399..1c9f4e5588 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -676,7 +676,6 @@ kern_sendmsg(int s, struct sockaddr *sa, struct uio *auio, #endif if (error == 0) *res = len - auio->uio_resid; -done: fdrop(fp); return (error); } @@ -856,7 +855,6 @@ kern_recvmsg(int s, struct sockaddr **sa, struct uio *auio, #endif if (error == 0) *res = len - auio->uio_resid; -done: fdrop(fp); return (error); } diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 650ad7f4cc..8217817ee6 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -3540,9 +3540,9 @@ bpdone(struct buf *bp, int elseit) } #if defined(VFS_BIO_DEBUG) if (OFF_TO_IDX(foff) != m->pindex) { - kprintf( -"biodone: foff(%lu)/m->pindex(%d) mismatch\n", - (unsigned long)foff, m->pindex); + kprintf("biodone: foff(%lu)/m->pindex(%ld) " + "mismatch\n", + (unsigned long)foff, (long)m->pindex); } #endif diff --git a/sys/libkern/bsearch.c b/sys/libkern/bsearch.c index aa8d8e6e99..75a19bdb13 100644 --- a/sys/libkern/bsearch.c +++ b/sys/libkern/bsearch.c @@ -51,7 +51,7 @@ * look at item 3. */ void * -bsearch(const void *key, const void *base0, size_t nmemb, size_t size, +kbsearch(const void *key, const void *base0, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { const char *base = base0; diff --git a/sys/net/pf/pf.c b/sys/net/pf/pf.c index 1e1c346cc1..f3df6f8691 100644 --- a/sys/net/pf/pf.c +++ b/sys/net/pf/pf.c @@ -4432,6 +4432,11 @@ pf_test_state_icmp(struct pf_state **state, int direction, struct pfi_kif *kif, } while (!terminal); break; #endif /* INET6 */ + default: + DPFPRINTF(PF_DEBUG_MISC, + ("pf: ICMP AF %d unknown (ip6)\n", pd->af)); + return (PF_DROP); + break; } switch (pd2.proto) { diff --git a/sys/net/tap/if_tap.c b/sys/net/tap/if_tap.c index 481544543e..8fc6964400 100644 --- a/sys/net/tap/if_tap.c +++ b/sys/net/tap/if_tap.c @@ -880,7 +880,7 @@ tapwrite(struct dev_write_args *ap) return (0); if (uio->uio_resid > TAPMRU) { - TAPDEBUG(ifp, "invalid packet len = %ld, minor = %#x\n", + TAPDEBUG(ifp, "invalid packet len = %zu, minor = %#x\n", uio->uio_resid, minor(tp->tap_dev)); return (EIO); diff --git a/sys/netinet6/ah_output.c b/sys/netinet6/ah_output.c index 8a555e18cb..64205d05c1 100644 --- a/sys/netinet6/ah_output.c +++ b/sys/netinet6/ah_output.c @@ -296,6 +296,8 @@ ah4_output(struct mbuf *m, struct ipsecrequest *isr) if (finaldst) { dst.s_addr = ip->ip_dst.s_addr; ip->ip_dst.s_addr = finaldst->s_addr; + } else { + dst.s_addr = 0; /* fix compiler warning */ } /* diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 406f20c90c..79885d8b47 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1422,7 +1422,7 @@ ip6_notify_pmtu(struct inpcb *in6p, struct sockaddr_in6 *dst, u_int32_t *mtu) IPV6_PATHMTU, IPPROTO_IPV6)) == NULL) return; - if (sbappendaddr(&so->so_rcv, (struct sockaddr *)dst, NULL, m_mtu) + if (sbappendaddr(&so->so_rcv.sb, (struct sockaddr *)dst, NULL, m_mtu) == 0) { m_freem(m_mtu); /* XXX: should count statistics */ diff --git a/sys/netproto/ipx/ipx_pcb.h b/sys/netproto/ipx/ipx_pcb.h index df18d2b81b..70d83fab83 100644 --- a/sys/netproto/ipx/ipx_pcb.h +++ b/sys/netproto/ipx/ipx_pcb.h @@ -92,7 +92,7 @@ void ipx_pcbdetach (struct ipxpcb *ipxp); void ipx_pcbdisconnect (struct ipxpcb *ipxp); struct ipxpcb * ipx_pcblookup (struct ipx_addr *faddr, int lport, int wildp); -void ipx_pcbnotify (struct ipx_addr *dst, int errno, +void ipx_pcbnotify (struct ipx_addr *dst, int error, void (*notify)(struct ipxpcb *), long param); void ipx_setpeeraddr (struct ipxpcb *ipxp, struct sockaddr **nam); void ipx_setsockaddr (struct ipxpcb *ipxp, struct sockaddr **nam); diff --git a/sys/netproto/ipx/ipx_var.h b/sys/netproto/ipx/ipx_var.h index d2a6be0ef6..ed48c72a8c 100644 --- a/sys/netproto/ipx/ipx_var.h +++ b/sys/netproto/ipx/ipx_var.h @@ -93,7 +93,7 @@ int ipx_control (struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, struct thread *td); void ipx_ctlinput (int cmd, struct sockaddr *arg_as_sa, void *dummy); int ipx_ctloutput (struct socket *so, struct sockopt *sopt); -void ipx_drop (struct ipxpcb *ipxp, int errno); +void ipx_drop (struct ipxpcb *ipxp, int error); void ipx_init (void); void ipx_input (struct mbuf *m, struct ipxpcb *ipxp); int ipx_outputfl (struct mbuf *m0, struct route *ro, int flags); diff --git a/sys/opencrypto/cast.c b/sys/opencrypto/cast.c index bd82bfa30a..58671648fd 100644 --- a/sys/opencrypto/cast.c +++ b/sys/opencrypto/cast.c @@ -131,8 +131,13 @@ u_int32_t t, l, r; void cast_setkey(cast_key* key, u_int8_t* rawkey, int keybytes) { -u_int32_t t[4], z[4], x[4]; -int i; + u_int32_t t[4], z[4], x[4]; + int i; + + /* Remove compiler warnings */ + for (i = 0; i < 4; i++) { + t[i] = z[i] = 0; + } /* Set number of rounds to 12 or 16, depending on key length */ key->rounds = (keybytes <= 10 ? 12 : 16); diff --git a/sys/platform/pc32/apic/mpapic.c b/sys/platform/pc32/apic/mpapic.c index d6aec3f761..3990f96618 100644 --- a/sys/platform/pc32/apic/mpapic.c +++ b/sys/platform/pc32/apic/mpapic.c @@ -993,7 +993,7 @@ lapic_map(vm_offset_t lapic_addr) SMPpt[NPTEPG - 1] = (pt_entry_t)(PG_V | PG_RW | PG_N | pmap_get_pgeflag() | (lapic_addr & PG_FRAME)); - kprintf("lapic: at 0x%08x\n", lapic_addr); + kprintf("lapic: at %p\n", (void *)lapic_addr); } static TAILQ_HEAD(, lapic_enumerator) lapic_enumerators = diff --git a/sys/platform/pc32/i386/machdep.c b/sys/platform/pc32/i386/machdep.c index 2811b2c6a5..9f9ed9ef95 100644 --- a/sys/platform/pc32/i386/machdep.c +++ b/sys/platform/pc32/i386/machdep.c @@ -1433,7 +1433,6 @@ getmemsize(int first) vm_offset_t physmap[PHYSMAP_ENTRIES*2]; pt_entry_t *pte; quad_t maxmem; - const char *cp; struct { u_int64_t base; u_int64_t length; diff --git a/sys/platform/pc32/i386/mp_machdep.c b/sys/platform/pc32/i386/mp_machdep.c index 1843ca42bf..b6c4e4df36 100644 --- a/sys/platform/pc32/i386/mp_machdep.c +++ b/sys/platform/pc32/i386/mp_machdep.c @@ -557,7 +557,7 @@ mp_announce(void) for (x = 0; x < mp_napics; ++x) { kprintf(" io%d (APIC): apic id: %2d", x, IO_TO_ID(x)); kprintf(", version: 0x%08x", io_apic_versions[x]); - kprintf(", at 0x%08x\n", io_apic_address[x]); + kprintf(", at 0x%08lx\n", io_apic_address[x]); } #else kprintf(" Warning: APIC I/O disabled\n"); diff --git a/sys/platform/pc32/i386/pmap.c b/sys/platform/pc32/i386/pmap.c index cc2e6668f4..fae3014c3a 100644 --- a/sys/platform/pc32/i386/pmap.c +++ b/sys/platform/pc32/i386/pmap.c @@ -1616,9 +1616,9 @@ pmap_remove_pte(struct pmap *pmap, unsigned *ptq, vm_offset_t va, if (oldpte & PG_M) { #if defined(PMAP_DIAGNOSTIC) if (pmap_nw_modified((pt_entry_t) oldpte)) { - kprintf( - "pmap_remove: modified page not writable: va: 0x%x, pte: 0x%x\n", - va, oldpte); + kprintf("pmap_remove: modified page not " + "writable: va: %p, pte: 0x%lx\n", + (void *)va, (long)oldpte); } #endif if (pmap_track_modified(va)) @@ -1798,9 +1798,9 @@ pmap_remove_all(vm_page_t m) if (tpte & PG_M) { #if defined(PMAP_DIAGNOSTIC) if (pmap_nw_modified((pt_entry_t) tpte)) { - kprintf( - "pmap_remove_all: modified page not writable: va: 0x%x, pte: 0x%x\n", - pv->pv_va, tpte); + kprintf("pmap_remove_all: modified page " + "not writable: va: %p, pte: 0x%lx\n", + (void *)pv->pv_va, (long)tpte); } #endif if (pmap_track_modified(pv->pv_va)) @@ -1951,8 +1951,10 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, #ifdef PMAP_DIAGNOSTIC if (va >= KvaEnd) panic("pmap_enter: toobig"); - if ((va >= UPT_MIN_ADDRESS) && (va < UPT_MAX_ADDRESS)) - panic("pmap_enter: invalid to pmap_enter page table pages (va: 0x%x)", va); + if ((va >= UPT_MIN_ADDRESS) && (va < UPT_MAX_ADDRESS)) { + panic("pmap_enter: invalid to pmap_enter page " + "table pages (va: %p)", (void *)va); + } #endif if (va < UPT_MAX_ADDRESS && pmap == &kernel_pmap) { kprintf("Warning: pmap_enter called on UVA with kernel_pmap\n"); @@ -1979,8 +1981,8 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, * Page Directory table entry not valid, we need a new PT page */ if (pte == NULL) { - panic("pmap_enter: invalid page directory pdir=%x, va=0x%x\n", - (unsigned) pmap->pm_pdir[PTDPTDI], va); + panic("pmap_enter: invalid page directory pdir=0x%lx, va=%p\n", + (long)pmap->pm_pdir[PTDPTDI], (void *)va); } pa = VM_PAGE_TO_PHYS(m) & PG_FRAME; @@ -2007,9 +2009,9 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, #if defined(PMAP_DIAGNOSTIC) if (pmap_nw_modified((pt_entry_t) origpte)) { - kprintf( - "pmap_enter: modified page not writable: va: 0x%x, pte: 0x%x\n", - va, origpte); + kprintf("pmap_enter: modified page not " + "writable: va: %p, pte: 0x%lx\n", + (void *)va, (long )origpte); } #endif @@ -2045,7 +2047,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, int err; err = pmap_remove_pte(pmap, pte, va, &info); if (err) - panic("pmap_enter: pte vanished, va: 0x%x", va); + panic("pmap_enter: pte vanished, va: %p", (void *)va); } /* @@ -2918,7 +2920,8 @@ pmap_testbit(vm_page_t m, int bit) #if defined(PMAP_DIAGNOSTIC) if (!pv->pv_pmap) { - kprintf("Null pmap (tb) at va: 0x%x\n", pv->pv_va); + kprintf("Null pmap (tb) at va: %p\n", + (void *)pv->pv_va); continue; } #endif @@ -2964,7 +2967,8 @@ pmap_clearbit(vm_page_t m, int bit) #if defined(PMAP_DIAGNOSTIC) if (!pv->pv_pmap) { - kprintf("Null pmap (cb) at va: 0x%x\n", pv->pv_va); + kprintf("Null pmap (cb) at va: %p\n", + (void *)pv->pv_va); continue; } #endif @@ -3394,10 +3398,11 @@ pmap_pvdump(vm_paddr_t pa) m = PHYS_TO_VM_PAGE(pa); TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { #ifdef used_to_be - kprintf(" -> pmap %p, va %x, flags %x", - (void *)pv->pv_pmap, pv->pv_va, pv->pv_flags); + kprintf(" -> pmap %p, va %p, flags %x", + (void *)pv->pv_pmap, (long)pv->pv_va, pv->pv_flags); #endif - kprintf(" -> pmap %p, va %x", (void *)pv->pv_pmap, pv->pv_va); + kprintf(" -> pmap %p, va %p", + (void *)pv->pv_pmap, (void *)pv->pv_va); pads(pv->pv_pmap); } kprintf(" "); diff --git a/sys/platform/pc32/i386/trap.c b/sys/platform/pc32/i386/trap.c index 2e66c5e5cc..771101e671 100644 --- a/sys/platform/pc32/i386/trap.c +++ b/sys/platform/pc32/i386/trap.c @@ -1024,7 +1024,7 @@ trap_fatal(struct trapframe *frame, vm_offset_t eva) kprintf("lapic.id = %08x\n", lapic.id); #endif if (type == T_PAGEFLT) { - kprintf("fault virtual address = 0x%x\n", eva); + kprintf("fault virtual address = %p\n", (void *)eva); kprintf("fault code = %s %s, %s\n", code & PGEX_U ? "user" : "supervisor", code & PGEX_W ? "write" : "read", diff --git a/sys/platform/vkernel/i386/trap.c b/sys/platform/vkernel/i386/trap.c index 1c92e972da..e90fedc608 100644 --- a/sys/platform/vkernel/i386/trap.c +++ b/sys/platform/vkernel/i386/trap.c @@ -952,7 +952,7 @@ trap_fatal(struct trapframe *frame, int usermode, vm_offset_t eva) kprintf("cpuid = %d\n", mycpu->gd_cpuid); #endif if (type == T_PAGEFLT) { - kprintf("fault virtual address = 0x%x\n", eva); + kprintf("fault virtual address = %p\n", (void *)eva); kprintf("fault code = %s %s, %s\n", usermode ? "user" : "supervisor", code & PGEX_W ? "write" : "read", diff --git a/sys/platform/vkernel/platform/pmap.c b/sys/platform/vkernel/platform/pmap.c index 1a2ca6cd8b..ec0aa9d725 100644 --- a/sys/platform/vkernel/platform/pmap.c +++ b/sys/platform/vkernel/platform/pmap.c @@ -1827,7 +1827,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, int err; err = pmap_remove_pte(pmap, pte, va); if (err) - panic("pmap_enter: pte vanished, va: 0x%x", va); + panic("pmap_enter: pte vanished, va: %p", (void *)va); } /* diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index d52763fcc2..4cb8da1c1b 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -88,7 +88,7 @@ static __inline size_t szmin(size_t a, size_t b) { return (a < b ? a : b); } /* Prototypes for non-quad routines. */ u_int32_t karc4random (void); int bcmp (const void *, const void *, size_t); -void *bsearch (const void *, const void *, size_t, +void *kbsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); #ifndef HAVE_INLINE_FFS int ffs (int); diff --git a/sys/vfs/nfs/nfs_serv.c b/sys/vfs/nfs/nfs_serv.c index b0709d6eea..6ffa5105e0 100644 --- a/sys/vfs/nfs/nfs_serv.c +++ b/sys/vfs/nfs/nfs_serv.c @@ -295,6 +295,9 @@ nfsrv_setattr(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, info.dpos = nfsd->nd_dpos; info.v3 = (nfsd->nd_flag & ND_NFSV3); + guard.tv_sec = 0; /* fix compiler warning */ + guard.tv_nsec = 0; + nfsdbprintf(("%s %d\n", __FILE__, __LINE__)); fhp = &nfh.fh_generic; NEGREPLYOUT(nfsm_srvmtofh(&info, nfsd, fhp, &error)); diff --git a/sys/vfs/nfs/nfs_socket.c b/sys/vfs/nfs/nfs_socket.c index 540816e477..54a31f8deb 100644 --- a/sys/vfs/nfs/nfs_socket.c +++ b/sys/vfs/nfs/nfs_socket.c @@ -1607,6 +1607,9 @@ nfs_rephead(int siz, struct nfsrv_descript *nd, struct nfssvc_sock *slp, */ #ifdef NFSKERB XXX +#else + ktvout.tv_sec = 0; + ktvout.tv_usec = 0; #endif *tl++ = rpc_auth_kerb; @@ -2392,6 +2395,9 @@ nfs_getreq(struct nfsrv_descript *nd, struct nfsd *nfsd, int has_header) */ #ifdef NFSKERB XXX +#else + tvout.tv_sec = 0; + tvout.tv_usec = 0; #endif tvout.tv_sec = fxdr_unsigned(long, tvout.tv_sec); diff --git a/sys/vfs/nfs/nfs_syscalls.c b/sys/vfs/nfs/nfs_syscalls.c index cc49340ff6..e71f6f2178 100644 --- a/sys/vfs/nfs/nfs_syscalls.c +++ b/sys/vfs/nfs/nfs_syscalls.c @@ -981,6 +981,9 @@ nfs_getnickauth(struct nfsmount *nmp, struct ucred *cred, char **auth_str, */ #ifdef NFSKERB XXX +#else + ktvout.tv_sec = 0; + ktvout.tv_usec = 0; #endif *verfp++ = ktvout.tv_sec; @@ -1019,6 +1022,9 @@ nfs_savenickauth(struct nfsmount *nmp, struct ucred *cred, int len, */ #ifdef NFSKERB XXX +#else + ktvout.tv_sec = 0; + ktvout.tv_usec = 0; #endif ktvout.tv_sec = fxdr_unsigned(long, ktvout.tv_sec); ktvout.tv_usec = fxdr_unsigned(long, ktvout.tv_usec); diff --git a/sys/vfs/udf/udf_vnops.c b/sys/vfs/udf/udf_vnops.c index aa88021dbb..1ff6e18778 100644 --- a/sys/vfs/udf/udf_vnops.c +++ b/sys/vfs/udf/udf_vnops.c @@ -717,8 +717,10 @@ udf_readdir(struct vop_readdir_args *a) uiodir.ncookies = ncookies; uiodir.cookies = cookies; uiodir.acookies = 0; - } else + } else { uiodir.cookies = NULL; + uiodir.ncookies = 0; + } /* * Iterate through the file id descriptors. Give the parent dir -- 2.41.0