diff options
author | Toomas Soome <tsoome@me.com> | 2019-01-26 17:16:49 +0200 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2019-07-30 22:48:16 +0300 |
commit | f9409f99581bedf7777548eccf1310c6995764a0 (patch) | |
tree | b06c1580a4fa5f4a5e2a6452b02c3df9062d61ea | |
parent | ce5e7d21f9e2e48a2f9b5a23ffec805e334d513e (diff) | |
download | illumos-joyent-f9409f99581bedf7777548eccf1310c6995764a0.tar.gz |
11432 stat: NULL pointer errors
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r-- | usr/src/cmd/stat/common/acquire_iodevs.c | 9 | ||||
-rw-r--r-- | usr/src/cmd/stat/common/dsr.c | 6 | ||||
-rw-r--r-- | usr/src/cmd/stat/mpstat/mpstat.c | 10 |
3 files changed, 12 insertions, 13 deletions
diff --git a/usr/src/cmd/stat/common/acquire_iodevs.c b/usr/src/cmd/stat/common/acquire_iodevs.c index 4fd1115142..2a88b89e28 100644 --- a/usr/src/cmd/stat/common/acquire_iodevs.c +++ b/usr/src/cmd/stat/common/acquire_iodevs.c @@ -355,7 +355,7 @@ iodev_match(struct iodev_snapshot *dev, struct iodev_filter *df) return (1); /* pass */ /* no filtered names, pass if not floppy and skipped */ - if (df->if_nr_names == NULL) + if (df->if_nr_names == 0) return (!(df->if_skip_floppy && is_floppy)); isn = dev->is_name; @@ -451,7 +451,7 @@ choose_iodevs(struct snapshot *ss, struct iodev_snapshot *iodevs, * don't want to fill the remaining slots - it is just confusing * if we don that, it makes it look like the filter code is broken. */ - if ((df->if_nr_names == NULL) || (nr_iodevs != nr_iodevs_orig)) { + if ((df->if_nr_names == 0) || (nr_iodevs != nr_iodevs_orig)) { /* now insert any iodevs into the remaining slots */ pos = iodevs; while (pos && nr_iodevs) { @@ -627,7 +627,7 @@ get_ids(struct iodev_snapshot *iodev, const char *pretty) static void get_pretty_name(enum snapshot_types types, struct iodev_snapshot *iodev, - kstat_ctl_t *kc) + kstat_ctl_t *kc) { disk_list_t *dl; char *pretty = NULL; @@ -683,8 +683,7 @@ get_iodev_type(kstat_t *ksp) /* get the lun/target/initiator from the name, return 1 on success */ static int -get_lti(char *s, - char *lname, int *l, char *tname, int *t, char *iname, int *i) +get_lti(char *s, char *lname, int *l, char *tname, int *t, char *iname, int *i) { int num = 0; diff --git a/usr/src/cmd/stat/common/dsr.c b/usr/src/cmd/stat/common/dsr.c index e9db7e3042..b1af45c653 100644 --- a/usr/src/cmd/stat/common/dsr.c +++ b/usr/src/cmd/stat/common/dsr.c @@ -291,7 +291,7 @@ lookup_ks_name(char *ks_name, int want_devid) goto fail; part = strchr(ks_name, ','); /* start of ",<partition>" */ - p = strchr(ks_name, ':'); /* start of ":<partition>" */ + p = strchr(ks_name, ':'); /* start of ":<partition>" */ if (part != NULL && p != NULL) goto fail; /* can't have both */ if (p != NULL) @@ -508,7 +508,7 @@ again: if (*cp == ',') { cp++; while (*cp != ':') { - if (*cp == NULL) + if (*cp == '\0') return (NULL); cp++; } @@ -520,7 +520,7 @@ again: */ while (*cp) { if (isspace(*cp) || *cp == ',') { - *cp = NULL; + *cp = '\0'; return (path); } cp++; diff --git a/usr/src/cmd/stat/mpstat/mpstat.c b/usr/src/cmd/stat/mpstat/mpstat.c index 64324224fd..e945988636 100644 --- a/usr/src/cmd/stat/mpstat/mpstat.c +++ b/usr/src/cmd/stat/mpstat/mpstat.c @@ -110,7 +110,7 @@ main(int argc, char **argv) usage(); display_pset = (int)strtol (optarg, &endptr, 10); - if (*endptr != NULL) + if (*endptr != '\0') usage(); /* * Not valid to specify a negative processor @@ -143,13 +143,13 @@ main(int argc, char **argv) if (argc > optind) { interval = (int)strtol(argv[optind], &endptr, 10); - if (*endptr != NULL) + if (*endptr != '\0') usage(); period_n = (hrtime_t)interval * NANOSEC; if (argc > optind + 1) { iter = (unsigned int)strtoul (argv[optind + 1], &endptr, 10); - if (*endptr != NULL || iter < 0) + if (*endptr != '\0' || iter < 0) usage(); if (iter == 0) return (0); @@ -314,7 +314,7 @@ agg_vm(struct pset_snapshot *p, kstat_t *ks) { size_t i; - if (p->ps_nr_cpus == NULL) + if (p->ps_nr_cpus == 0) return (NULL); if (kstat_copy(&p->ps_cpus[0]->cs_vm, ks)) @@ -334,7 +334,7 @@ agg_sys(struct pset_snapshot *p, kstat_t *ks) { size_t i; - if (p->ps_nr_cpus == NULL) + if (p->ps_nr_cpus == 0) return (NULL); if (kstat_copy(&p->ps_cpus[0]->cs_sys, ks)) |