diff options
author | Toomas Soome <tsoome@me.com> | 2020-05-25 12:46:31 +0300 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2021-05-03 18:03:57 +0300 |
commit | ea429a71818e2432d0d0a924065a009b1e5abdd1 (patch) | |
tree | f9ff049643809c239f390c1697affa7b5509cd1a | |
parent | 6bb387f32ea92818dd741fd3f0164ceb3a2e989e (diff) | |
download | illumos-gate-ea429a71818e2432d0d0a924065a009b1e5abdd1.tar.gz |
13752 stat: variable may be used uninitialized
Reviewed by: C Fraire <cfraire@me.com>
Reviewed by: Sebastian Wiedenroth <sebastian.wiedenroth@skylime.net>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/cmd/stat/Makefile | 3 | ||||
-rw-r--r-- | usr/src/cmd/stat/arcstat/Makefile | 2 | ||||
-rw-r--r-- | usr/src/cmd/stat/common/dsr.c | 4 | ||||
-rw-r--r-- | usr/src/cmd/stat/fsstat/Makefile | 4 | ||||
-rw-r--r-- | usr/src/cmd/stat/iostat/Makefile | 5 | ||||
-rw-r--r-- | usr/src/cmd/stat/iostat/iostat.c | 67 | ||||
-rw-r--r-- | usr/src/cmd/stat/kstat/Makefile | 13 | ||||
-rw-r--r-- | usr/src/cmd/stat/mpstat/Makefile | 5 | ||||
-rw-r--r-- | usr/src/cmd/stat/mpstat/mpstat.c | 2 | ||||
-rw-r--r-- | usr/src/cmd/stat/vmstat/Makefile | 5 |
10 files changed, 38 insertions, 72 deletions
diff --git a/usr/src/cmd/stat/Makefile b/usr/src/cmd/stat/Makefile index 34149b2b37..8cfd474414 100644 --- a/usr/src/cmd/stat/Makefile +++ b/usr/src/cmd/stat/Makefile @@ -33,12 +33,11 @@ all := TARGET = all install := TARGET = install clean := TARGET = clean clobber := TARGET = clobber -lint := TARGET = lint _msg := TARGET = _msg .KEEP_STATE: -all install lint clean clobber _msg: $(SUBDIRS) +all install clean clobber _msg: $(SUBDIRS) $(SUBDIRS): FRC @cd $@; pwd; $(MAKE) $(MFLAGS) $(TARGET) diff --git a/usr/src/cmd/stat/arcstat/Makefile b/usr/src/cmd/stat/arcstat/Makefile index 6ae60a8d3d..8185c35125 100644 --- a/usr/src/cmd/stat/arcstat/Makefile +++ b/usr/src/cmd/stat/arcstat/Makefile @@ -28,6 +28,4 @@ clean: $(ROOTBINPROG): $(PROG) $(INS.file) -lint: - include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/stat/common/dsr.c b/usr/src/cmd/stat/common/dsr.c index b1af45c653..b4da581ac8 100644 --- a/usr/src/cmd/stat/common/dsr.c +++ b/usr/src/cmd/stat/common/dsr.c @@ -115,8 +115,8 @@ static int drvinstpart2dev(char *driver, int instance, char *part, char **devpathp, char **adevpathp, char **devidp) { - minor_match_t *mm, **mma = mma_disk_tape_misc; - char *devpath; + minor_match_t *mm = NULL, **mma = mma_disk_tape_misc; + char *devpath = NULL; char *devid; char *devicespath; di_node_t node; diff --git a/usr/src/cmd/stat/fsstat/Makefile b/usr/src/cmd/stat/fsstat/Makefile index a1aa7a883a..9916e28183 100644 --- a/usr/src/cmd/stat/fsstat/Makefile +++ b/usr/src/cmd/stat/fsstat/Makefile @@ -39,8 +39,6 @@ CFLAGS += $(CCVERBOSE) -I${STATCOMMONDIR} CERRWARN += -_gcc=-Wno-parentheses FILEMODE= 0555 -lint := LINTFLAGS = -muxs -I$(STATCOMMONDIR) - SMOFF += signed .KEEP_STATE: @@ -60,6 +58,4 @@ $(PROG): $(OBJS) $(COMMON_OBJS) clean: -$(RM) $(OBJS) $(COMMON_OBJS) -lint: lint_SRCS - include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/stat/iostat/Makefile b/usr/src/cmd/stat/iostat/Makefile index 0fb3c81080..76bb3fd112 100644 --- a/usr/src/cmd/stat/iostat/Makefile +++ b/usr/src/cmd/stat/iostat/Makefile @@ -32,13 +32,10 @@ include $(SRC)/cmd/stat/Makefile.stat LDLIBS += -lkstat -ldevinfo -lavl CFLAGS += $(CCVERBOSE) -I${STATCOMMONDIR} -CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses FILEMODE= 0555 -lint := LINTFLAGS = -muxs -I$(STATCOMMONDIR) - .KEEP_STATE: all: $(PROG) @@ -56,6 +53,4 @@ $(PROG): $(OBJS) $(COMMON_OBJS) clean: -$(RM) $(OBJS) $(COMMON_OBJS) -lint: lint_SRCS - include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/stat/iostat/iostat.c b/usr/src/cmd/stat/iostat/iostat.c index 50cb325889..cbfba9c40a 100644 --- a/usr/src/cmd/stat/iostat/iostat.c +++ b/usr/src/cmd/stat/iostat/iostat.c @@ -146,8 +146,8 @@ struct iodev_filter df; static uint_t suppress_state; /* skip state change messages */ static uint_t suppress_zero; /* skip zero valued lines */ static uint_t show_mountpts; /* show mount points */ -static int interval; /* interval (seconds) to output */ -static int iter; /* iterations from command line */ +static int interval; /* interval (seconds) to output */ +static int iter; /* iterations from command line */ #define SMALL_SCRATCH_BUFLEN MAXNAMELEN @@ -156,8 +156,8 @@ static int iodevs_nl; /* name field width */ #define IODEVS_NL_MAX 24 /* but keep full width under 80 */ static char disk_header[132]; -static uint_t dh_len; /* disk header length for centering */ -static int lineout; /* data waiting to be printed? */ +static uint_t dh_len; /* disk header length for centering */ +static int lineout; /* data waiting to be printed? */ static struct snapshot *newss; static struct snapshot *oldss; @@ -171,7 +171,7 @@ static format_t *formatter_list; static format_t *formatter_end; static u_longlong_t ull_delta(u_longlong_t, u_longlong_t); -static uint_t u32_delta(uint_t, uint_t); +static uint_t u32_delta(uint_t, uint_t); static void setup(void (*nfunc)(void)); static void print_tty_hdr1(void); static void print_tty_hdr2(void); @@ -206,7 +206,7 @@ main(int argc, char **argv) long hz; int forever; hrtime_t start_n; - hrtime_t period_n; + hrtime_t period_n = 0; (void) setlocale(LC_ALL, ""); #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ @@ -570,8 +570,9 @@ show_disk(void *v1, void *v2, void *data) struct iodev_snapshot *old = (struct iodev_snapshot *)v1; struct iodev_snapshot *new = (struct iodev_snapshot *)v2; int *count = (int *)data; - double rps, wps, tps, mtps, krps, kwps, kps, avw, avr, w_pct, r_pct; - double wserv, rserv, serv; + double rps = 0, wps = 0, tps = 0, mtps, krps = 0, kwps = 0; + double kps = 0, avw = 0, avr = 0, w_pct = 0, r_pct = 0; + double wserv = 0, rserv = 0, serv = 0; double iosize; /* kb/sec or MB/sec */ double etime, hr_etime; char *disk_name; @@ -944,35 +945,35 @@ usage(void) (void) fprintf(stderr, "Usage: iostat [-cCdDeEiImMnpPrstxXYz] " " [-l n] [-T d|u] [disk ...] [interval [count]]\n" - "\t\t-c: report percentage of time system has spent\n" + "\t\t-c: report percentage of time system has spent\n" "\t\t\tin user/system/dtrace/idle mode\n" - "\t\t-C: report disk statistics by controller\n" - "\t\t-d: display disk Kb/sec, transfers/sec, avg. \n" + "\t\t-C: report disk statistics by controller\n" + "\t\t-d: display disk Kb/sec, transfers/sec, avg. \n" "\t\t\tservice time in milliseconds \n" - "\t\t-D: display disk reads/sec, writes/sec, \n" + "\t\t-D: display disk reads/sec, writes/sec, \n" "\t\t\tpercentage disk utilization \n" - "\t\t-e: report device error summary statistics\n" - "\t\t-E: report extended device error statistics\n" + "\t\t-e: report device error summary statistics\n" + "\t\t-E: report extended device error statistics\n" "\t\t-i: show device IDs for -E output\n" - "\t\t-I: report the counts in each interval,\n" + "\t\t-I: report the counts in each interval,\n" "\t\t\tinstead of rates, where applicable\n" "\t\t-l n: Limit the number of disks to n\n" - "\t\t-m: Display mount points (most useful with -p)\n" - "\t\t-M: Display data throughput in MB/sec " + "\t\t-m: Display mount points (most useful with -p)\n" + "\t\t-M: Display data throughput in MB/sec " "instead of Kb/sec\n" - "\t\t-n: convert device names to cXdYtZ format\n" - "\t\t-p: report per-partition disk statistics\n" - "\t\t-P: report per-partition disk statistics only,\n" + "\t\t-n: convert device names to cXdYtZ format\n" + "\t\t-p: report per-partition disk statistics\n" + "\t\t-P: report per-partition disk statistics only,\n" "\t\t\tno per-device disk statistics\n" - "\t\t-r: Display data in comma separated format\n" - "\t\t-s: Suppress state change messages\n" + "\t\t-r: Display data in comma separated format\n" + "\t\t-s: Suppress state change messages\n" "\t\t-T d|u Display a timestamp in date (d) or unix " "time_t (u)\n" - "\t\t-t: display chars read/written to terminals\n" - "\t\t-x: display extended disk statistics\n" - "\t\t-X: display I/O path statistics\n" - "\t\t-Y: display I/O path (I/T/L) statistics\n" - "\t\t-z: Suppress entries with all zero values\n"); + "\t\t-t: display chars read/written to terminals\n" + "\t\t-x: display extended disk statistics\n" + "\t\t-X: display I/O path statistics\n" + "\t\t-Y: display I/O path (I/T/L) statistics\n" + "\t\t-z: Suppress entries with all zero values\n"); exit(1); } @@ -1077,10 +1078,10 @@ show_disk_errors(void *v1, void *v2, void *d) void do_args(int argc, char **argv) { - int c; - int errflg = 0; - extern char *optarg; - extern int optind; + int c; + int errflg = 0; + extern char *optarg; + extern int optind; while ((c = getopt(argc, argv, "tdDxXYCciIpPnmMeEszrT:l:")) != EOF) switch (c) { @@ -1272,8 +1273,8 @@ void do_format(void) { char header[SMALL_SCRATCH_BUFLEN] = {0}; - char ch; - char iosz; + char ch; + char iosz; const char *fstr; disk_header[0] = 0; diff --git a/usr/src/cmd/stat/kstat/Makefile b/usr/src/cmd/stat/kstat/Makefile index c315bf7c2c..7182ad8b11 100644 --- a/usr/src/cmd/stat/kstat/Makefile +++ b/usr/src/cmd/stat/kstat/Makefile @@ -34,7 +34,6 @@ include $(SRC)/cmd/stat/Makefile.stat LDLIBS += -lavl -lcmdutils -ldevinfo -lgen -lkstat CFLAGS += $(CCVERBOSE) -I${STATCOMMONDIR} -CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses @@ -43,16 +42,6 @@ CPPFLAGS += $(CPPFLAGS_$(MACH)) FILEMODE= 0555 -lint := LINTFLAGS = -muxs -I$(STATCOMMONDIR) - -# -# Maddeningly, lint both chokes on "%hhx" in a format string and refuses to be -# suppressed about it (ironically further complaining that the suppression -# directive itself is unused -- without suppressing the error itself). So we -# must unfortunately disable E_BAD_FORMAT_STR2 entirely... -# -lint := LINTFLAGS += -xerroff=E_BAD_FORMAT_STR2 - .KEEP_STATE: all: $(PROG) @@ -70,6 +59,4 @@ $(PROG): $(OBJS) $(COMMON_OBJS) clean: -$(RM) $(OBJS) $(COMMON_OBJS) -lint: lint_SRCS - include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/stat/mpstat/Makefile b/usr/src/cmd/stat/mpstat/Makefile index 8e34815c32..6f685faef4 100644 --- a/usr/src/cmd/stat/mpstat/Makefile +++ b/usr/src/cmd/stat/mpstat/Makefile @@ -32,13 +32,10 @@ include $(SRC)/cmd/stat/Makefile.stat LDLIBS += -ldevinfo -lkstat -lavl CFLAGS += $(CCVERBOSE) -I${STATCOMMONDIR} -CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses FILEMODE= 0555 -lint := LINTFLAGS = -muxs -I$(STATCOMMONDIR) - .KEEP_STATE: all: $(PROG) @@ -56,6 +53,4 @@ $(PROG): $(OBJS) $(COMMON_OBJS) clean: -$(RM) $(OBJS) $(COMMON_OBJS) -lint: lint_SRCS - include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/stat/mpstat/mpstat.c b/usr/src/cmd/stat/mpstat/mpstat.c index e945988636..e964cec969 100644 --- a/usr/src/cmd/stat/mpstat/mpstat.c +++ b/usr/src/cmd/stat/mpstat/mpstat.c @@ -78,7 +78,7 @@ main(int argc, char **argv) struct snapshot *new = NULL; enum snapshot_types types = SNAP_CPUS; hrtime_t start_n; - hrtime_t period_n; + hrtime_t period_n = 0; (void) setlocale(LC_ALL, ""); #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ diff --git a/usr/src/cmd/stat/vmstat/Makefile b/usr/src/cmd/stat/vmstat/Makefile index fcbbec9071..6f67243df9 100644 --- a/usr/src/cmd/stat/vmstat/Makefile +++ b/usr/src/cmd/stat/vmstat/Makefile @@ -34,15 +34,12 @@ include $(SRC)/cmd/stat/Makefile.stat LDLIBS += -ldevinfo -lkstat -lavl CFLAGS += $(CCVERBOSE) -I${STATCOMMONDIR} CERRWARN += -_gcc=-Wno-switch -CERRWARN += $(CNOWARN_UNINIT) CERRWARN += -_gcc=-Wno-parentheses SMOFF += signed FILEMODE= 0555 -lint := LINTFLAGS = -muxs -I$(STATCOMMONDIR) - .KEEP_STATE: all: $(PROG) @@ -60,6 +57,4 @@ $(PROG): $(OBJS) $(COMMON_OBJS) clean: -$(RM) $(OBJS) $(COMMON_OBJS) -lint: lint_SRCS - include $(SRC)/cmd/Makefile.targ |