summaryrefslogtreecommitdiff
path: root/usr/src/cmd/mdb/common/modules
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-05-24 10:30:08 +0300
committerToomas Soome <tsoome@me.com>2021-03-15 21:06:24 +0200
commit24537d3ef87e4452da693fc3143ef18a1a0f3cac (patch)
tree8ff494a1f5f27c27ab14b88d3dee19dec9481f9a /usr/src/cmd/mdb/common/modules
parent258f91c6020f3614878f3dcd49df02d9e004de2c (diff)
downloadillumos-gate-24537d3ef87e4452da693fc3143ef18a1a0f3cac.tar.gz
13617 mdb: variable may be used uninitialized
Reviewed by: Andy Fiddaman <andy@omniosce.org> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/cmd/mdb/common/modules')
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/genunix.c4
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/kmem.c2
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/lgrp.c8
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/net.c9
-rw-r--r--usr/src/cmd/mdb/common/modules/genunix/typegraph.c4
-rw-r--r--usr/src/cmd/mdb/common/modules/ipp/ipp.c4
-rw-r--r--usr/src/cmd/mdb/common/modules/libumem/umem.c2
-rw-r--r--usr/src/cmd/mdb/common/modules/pmcs/pmcs.c16
8 files changed, 27 insertions, 22 deletions
diff --git a/usr/src/cmd/mdb/common/modules/genunix/genunix.c b/usr/src/cmd/mdb/common/modules/genunix/genunix.c
index f8d2de5f12..2ef51166f6 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/genunix.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/genunix.c
@@ -3024,7 +3024,7 @@ cpu_walk_init(mdb_walk_state_t *wsp)
int max_ncpus, i = 0;
uintptr_t current, first;
cpu_t cpu, panic_cpu;
- uintptr_t panicstr, addr;
+ uintptr_t panicstr, addr = 0;
GElf_Sym sym;
cw = mdb_zalloc(sizeof (cpu_walk_t), UM_SLEEP | UM_GC);
@@ -3189,7 +3189,7 @@ cpuinfo_walk_cpu(uintptr_t addr, const cpu_t *cpu, cpuinfo_data_t *cid)
kthread_t t;
disp_t disp;
mdb_cpuinfo_proc_t p;
- uintptr_t pinned;
+ uintptr_t pinned = 0;
char **flagbuf;
int nflaglines = 0, flagline = 0, bspl, rval = WALK_NEXT;
diff --git a/usr/src/cmd/mdb/common/modules/genunix/kmem.c b/usr/src/cmd/mdb/common/modules/genunix/kmem.c
index 146317e012..87ae1430f9 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/kmem.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/kmem.c
@@ -1155,7 +1155,7 @@ kmem_walk_init_common(mdb_walk_state_t *wsp, int type)
size_t magmax, magcnt;
void **maglist = NULL;
- uint_t chunksize, slabsize;
+ uint_t chunksize = 1, slabsize = 1;
int status = WALK_ERR;
uintptr_t addr = wsp->walk_addr;
const char *layered;
diff --git a/usr/src/cmd/mdb/common/modules/genunix/lgrp.c b/usr/src/cmd/mdb/common/modules/genunix/lgrp.c
index aa798bdb00..a09978bd04 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/lgrp.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/lgrp.c
@@ -231,9 +231,9 @@ lgrp(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
int opt_q = 0; /* display only address. */
int i;
const char *s_index = NULL, *s_handle = NULL, *s_parent = NULL;
- uintptr_t index;
- uintptr_t handle;
- uintptr_t parent;
+ uintptr_t index = 0;
+ uintptr_t handle = 0;
+ uintptr_t parent = 0;
int filters = 0;
if (!(flags & DCMD_ADDRSPEC)) {
@@ -638,7 +638,7 @@ lgrp_set_walk_init(mdb_walk_state_t *wsp, klgrpset_t set)
lwsd->lswd_nlgrps = nlgrps;
if (mdb_readsym(lwsd->lwsd_lgrp_tbl, nlgrps * sizeof (lgrp_t *),
- "lgrp_table") == -1) {
+ "lgrp_table") == -1) {
mdb_warn("unable to read lgrp_table");
return (WALK_ERR);
}
diff --git a/usr/src/cmd/mdb/common/modules/genunix/net.c b/usr/src/cmd/mdb/common/modules/genunix/net.c
index f29407b76a..01ca4e68c4 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/net.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/net.c
@@ -384,7 +384,7 @@ sonode(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
const char *optf = NULL;
const char *optt = NULL;
const char *optp = NULL;
- int family, type, proto;
+ int family = AF_UNSPEC, type = 0, proto = 0;
int filter = 0;
struct sonode so;
@@ -1414,7 +1414,6 @@ do_show_bridge(uintptr_t addr, const void *data, void *ptr)
trill_nickinfo_t tni;
char bname[MAXLINKNAMELEN];
char macaddr[ETHERADDRL * 3];
- char *cp;
uint_t nnicks;
int i;
@@ -1430,9 +1429,9 @@ do_show_bridge(uintptr_t addr, const void *data, void *ptr)
(void) strncpy(bname, bip->bi_name, sizeof (bname) - 1);
bname[MAXLINKNAMELEN - 1] = '\0';
- cp = bname + strlen(bname);
- if (cp > bname && cp[-1] == '0')
- cp[-1] = '\0';
+ i = strlen(bname);
+ if (i > 1 && bname[i - 1] == '0')
+ bname[i - 1] = '\0';
if (args->name != NULL && strcmp(args->name, bname) != 0)
return (WALK_NEXT);
diff --git a/usr/src/cmd/mdb/common/modules/genunix/typegraph.c b/usr/src/cmd/mdb/common/modules/genunix/typegraph.c
index b7f6cf854d..ad68c39279 100644
--- a/usr/src/cmd/mdb/common/modules/genunix/typegraph.c
+++ b/usr/src/cmd/mdb/common/modules/genunix/typegraph.c
@@ -2765,7 +2765,7 @@ int
typeconflict_walk_step(mdb_walk_state_t *wsp)
{
size_t ndx;
- tg_node_t *node;
+ tg_node_t *node = NULL;
for (ndx = (size_t)wsp->walk_data; ndx < tg_nnodes; ndx++) {
node = &tg_node[ndx];
@@ -2793,7 +2793,7 @@ int
typeunknown_walk_step(mdb_walk_state_t *wsp)
{
size_t ndx;
- tg_node_t *node;
+ tg_node_t *node = NULL;
for (ndx = (size_t)wsp->walk_data; ndx < tg_nnodes; ndx++) {
node = &tg_node[ndx];
diff --git a/usr/src/cmd/mdb/common/modules/ipp/ipp.c b/usr/src/cmd/mdb/common/modules/ipp/ipp.c
index 8af4103c20..e744a3140b 100644
--- a/usr/src/cmd/mdb/common/modules/ipp/ipp.c
+++ b/usr/src/cmd/mdb/common/modules/ipp/ipp.c
@@ -568,7 +568,7 @@ dump_classes(
uint_t nelt)
{
ipp_class_t *array;
- ipp_class_t *cp;
+ ipp_class_t *cp = NULL;
uint_t i;
boolean_t first_time = B_TRUE;
char buf[MAXNAMELEN];
@@ -601,7 +601,7 @@ dump_log(
uint_t nelt)
{
ipp_log_t *array;
- ipp_log_t *lp;
+ ipp_log_t *lp = NULL;
uint_t i;
boolean_t first_time = B_TRUE;
char buf[MAXNAMELEN];
diff --git a/usr/src/cmd/mdb/common/modules/libumem/umem.c b/usr/src/cmd/mdb/common/modules/libumem/umem.c
index 018a33dd46..a1b3df481b 100644
--- a/usr/src/cmd/mdb/common/modules/libumem/umem.c
+++ b/usr/src/cmd/mdb/common/modules/libumem/umem.c
@@ -1119,7 +1119,7 @@ umem_walk_init_common(mdb_walk_state_t *wsp, int type)
size_t magmax, magcnt;
void **maglist = NULL;
- uint_t chunksize, slabsize;
+ uint_t chunksize = 1, slabsize = 1;
int status = WALK_ERR;
uintptr_t addr = wsp->walk_addr;
const char *layered;
diff --git a/usr/src/cmd/mdb/common/modules/pmcs/pmcs.c b/usr/src/cmd/mdb/common/modules/pmcs/pmcs.c
index 4ff1bc068f..b010a02a8e 100644
--- a/usr/src/cmd/mdb/common/modules/pmcs/pmcs.c
+++ b/usr/src/cmd/mdb/common/modules/pmcs/pmcs.c
@@ -771,6 +771,9 @@ display_targets(struct pmcs_hw m, int verbose, int totals_only)
dtype = "SMP";
smp_targets++;
break;
+ default:
+ dtype = "Unknown";
+ break;
}
if (totals_only) {
@@ -1951,7 +1954,7 @@ display_phy(struct pmcs_phy phy, struct pmcs_phy *phyp, int verbose,
char *asent = no;
char *dead = no;
char *changed = no;
- char route_attr, route_method;
+ char route_attr, route_method = '\0';
switch (phy.dtype) {
case NOTHING:
@@ -1975,6 +1978,9 @@ display_phy(struct pmcs_phy phy, struct pmcs_phy *phyp, int verbose,
++exp_phys;
}
break;
+ default:
+ dtype = "Unknown";
+ break;
}
if (phy.dtype == NOTHING) {
@@ -2556,7 +2562,7 @@ display_matching_work(struct pmcs_hw ss, uintmax_t index, uintmax_t snum,
uintptr_t _wp;
boolean_t printed_header = B_FALSE;
uint32_t mask, mask_val, match_val;
- char *match_type;
+ char *match_type = NULL;
if (index != UINT_MAX) {
match_type = "index";
@@ -2627,7 +2633,7 @@ pmcs_tag(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
uintmax_t index = UINT_MAX;
int args = 0;
void *pmcs_state;
- char *state_str;
+ char *state_str = NULL;
struct dev_info dip;
if (!(flags & DCMD_ADDRSPEC)) {
@@ -2928,10 +2934,10 @@ pmcs_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
uint_t fwlog = FALSE;
boolean_t devid_filter = FALSE;
uintptr_t pdevid;
- uint32_t devid;
+ uint32_t devid = 0;
int rv = DCMD_OK;
void *pmcs_state;
- char *state_str;
+ char *state_str = NULL;
struct dev_info dip;
per_iport_setting_t pis;