Nick Todd - Sun Microsystems writes:
> http://cr.opensolaris.org/~nickto/simple-lint-fixes
General comment:
It sure would be nice to have a fix for CR 4994570, especially as
the fix has been understood for four years. Having that fix would
avoid a lot of this printf-related rototilling -- almost all, in
fact.
usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/dhcp.c
usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/interfaces.c
usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/logging.c
usr/src/cmd/cmd-inet/usr.lib/in.dhcpd/main.c
Reviewed; no comments.
usr/src/cmd/cmd-inet/usr.lib/inetd/tlx.c
517: what was probably intended here was t_strerror(t_errno).
usr/src/lib/libc/i386/sys/ptrace.c
usr/src/lib/libuutil/common/uu_avl.c
usr/src/lib/libuutil/common/uu_list.c
usr/src/psm/promif/ieee1275/common/prom_test.c
usr/src/psm/stand/cpr/sparcv9/sun4u/bitmap.c
usr/src/uts/common/brand/lx/os/lx_syscall.c
usr/src/uts/common/cpr/cpr_dump.c
usr/src/uts/common/cpr/cpr_misc.c
usr/src/uts/common/cpr/cpr_uthread.c
usr/src/uts/common/fs/cachefs/cachefs_vnops.c
1088,7516: these asserts are swilly. The don't really assert
anything about the running code versus its design, but rather static
conditions that may or may not be true.
For what it's worth, the way I've handled this in the past is by
tricking the compiler's optimizer:
#ifndef lint
extern void pagesize_is_larger_than_maxbsize(void);
if (PAGESIZE > MAXBSIZE)
pagesize_is_larger_than_maxbsize();
#endif
The trick is that when that condition isn't true (it shouldn't be
true), the compiler optimizes away the test and the call, so no
reference to that intentionally-undefined function occurs. When the
condition evaluates true (the failure case), the call is inserted in
the generated code, and the code will fail to link, producing a
hopefully-readable diagnostic message.
If you know that all involved are simple integer #defines, then
something simpler is possible:
#if PAGESIZE > MAXBSIZE
#error "PAGESIZE is larger than MAXBSIZE"
#endif
usr/src/uts/common/fs/nfs/nfs_log.c
usr/src/uts/common/fs/sockfs/socksctp.h
usr/src/uts/common/fs/sockfs/socksctpsubr.c
usr/src/uts/common/fs/sockfs/socksctpvnops.c
usr/src/uts/common/fs/sockfs/socksdpsubr.c
usr/src/uts/common/fs/sockfs/sockssl.c
usr/src/uts/common/fs/sockfs/sockstr.c
Reviewed; no comments.
usr/src/uts/common/fs/sockfs/socksubr.c
2029: gee ... hope that's a big enough static buffer in the middle
of the kernel.
2032,2041,2048,2062,2067: these should probably be snprintf.
2063: not your change, but '== NULL' looks bogus.
usr/src/uts/common/fs/sockfs/socksyscalls.c
usr/src/uts/common/fs/sockfs/socktpi.c
usr/src/uts/common/fs/sockfs/sockvnops.c
General: we probably need an RFE filed to have these 'dprintso'
things ripped out.
usr/src/uts/common/fs/tmpfs/tmp_tnode.c
145: what does this hide? (Is the macro properly defined?)
usr/src/uts/common/fs/zfs/dnode_sync.c
usr/src/uts/common/fs/zfs/zfs_znode.c
usr/src/uts/common/inet/ip/ip_mroute.c
Reviewed; no comments.
usr/src/uts/common/io/cardbus/cardbus.c
165: is ripping out stray SCCS keywords outside the scope of this
putback?
usr/src/uts/common/io/cpc.c
903: ditto to above.
usr/src/uts/common/io/hxge/hxge_ndd.c
I'm going to have to scrub my eyeballs when I'm done with this
review.
usr/src/uts/common/io/mem.c
86: is this extern really not needed otherwise? That's weird, and
probably deserves a comment of its own.
86-88: this looks misplaced given the comment above. That comment
describes the #define now on line 90.
usr/src/uts/common/io/pcic.c
usr/src/uts/common/io/tl.c
usr/src/uts/common/os/condvar.c
usr/src/uts/common/os/kstat_fr.c
usr/src/uts/common/os/mem_cage.c
usr/src/uts/common/os/memlist_new.c
usr/src/uts/common/os/rctl.c
usr/src/uts/common/os/vmem.c
usr/src/uts/common/vm/page_lock.c
usr/src/uts/i86pc/vm/hat_i86.c
usr/src/uts/i86pc/vm/htable.c
usr/src/uts/i86pc/vm/vm_machdep.c
usr/src/uts/i86xpv/os/xpv_panic.c
usr/src/uts/intel/io/dktp/hba/ghd/ghd.c
usr/src/uts/intel/io/dktp/hba/ghd/ghd_dma.c
usr/src/uts/intel/io/dktp/hba/ghd/ghd_scsa.c
usr/src/uts/intel/io/dktp/hba/ghd/ghd_timer.c
usr/src/uts/intel/io/dktp/hba/ghd/ghd_waitq.c
usr/src/uts/sfmmu/vm/hat_sfmmu.c
usr/src/uts/sun4/io/rootnex.c
usr/src/uts/sun4/os/ddi_impl.c
usr/src/uts/sun4/os/prom_subr.c
usr/src/uts/sun4u/io/isadma.c
usr/src/uts/sun4u/io/pmubus.c
usr/src/uts/sun4u/io/sbd.c
usr/src/uts/sun4u/io/sysiosbus.c
usr/src/uts/sun4u/io/todds1287.c
usr/src/uts/sun4u/os/cpr_impl.c
usr/src/uts/sun4u/os/fillsysinfo.c
usr/src/uts/sun4v/os/hsvc.c
usr/src/uts/sun4v/vm/mach_kpm.c
Reviewed; no comments.
--
James Carlson, Solaris Networking <james.d.carlson at sun.com>
Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677