aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorUbuntu <[email protected]>2019-12-14 00:07:48 +0000
committerBrian Behlendorf <[email protected]>2019-12-18 17:24:29 -0800
commit7cf1fe63316d20ae7986b4060337d0e2966a42b1 (patch)
treef218b0a18b510994d5ac4c9dcecb1c626c6459ce /module
parent5215fdd43c3edd25897b8257d802b68ca5583646 (diff)
cppcheck: (error) Uninitialized variable
As of cppcheck 1.82 warnings are issued when using the list_for_each_* functions with an uninitialized variable. Functionally, this is fine but to resolve the warning initialize these variables. Reviewed-by: Tony Hutter <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #9732
Diffstat (limited to 'module')
-rw-r--r--module/os/linux/spl/spl-generic.c2
-rw-r--r--module/os/linux/spl/spl-kmem-cache.c13
-rw-r--r--module/os/linux/spl/spl-kmem.c4
-rw-r--r--module/os/linux/spl/spl-kstat.c6
-rw-r--r--module/os/linux/spl/spl-proc.c4
-rw-r--r--module/os/linux/spl/spl-taskq.c12
-rw-r--r--module/os/linux/spl/spl-tsd.c2
-rw-r--r--module/os/linux/spl/spl-vmem.c2
8 files changed, 23 insertions, 22 deletions
diff --git a/module/os/linux/spl/spl-generic.c b/module/os/linux/spl/spl-generic.c
index aa1051f5d..8a14acd11 100644
--- a/module/os/linux/spl/spl-generic.c
+++ b/module/os/linux/spl/spl-generic.c
@@ -697,7 +697,7 @@ static void __init
spl_random_init(void)
{
uint64_t s[2];
- int i;
+ int i = 0;
get_random_bytes(s, sizeof (s));
diff --git a/module/os/linux/spl/spl-kmem-cache.c b/module/os/linux/spl/spl-kmem-cache.c
index 46cf2f288..452625718 100644
--- a/module/os/linux/spl/spl-kmem-cache.c
+++ b/module/os/linux/spl/spl-kmem-cache.c
@@ -344,7 +344,7 @@ static spl_kmem_slab_t *
spl_slab_alloc(spl_kmem_cache_t *skc, int flags)
{
spl_kmem_slab_t *sks;
- spl_kmem_obj_t *sko, *n;
+ spl_kmem_obj_t *sko;
void *base, *obj;
uint32_t obj_size, offslab_size = 0;
int i, rc = 0;
@@ -388,6 +388,7 @@ spl_slab_alloc(spl_kmem_cache_t *skc, int flags)
out:
if (rc) {
+ spl_kmem_obj_t *n = NULL;
if (skc->skc_flags & KMC_OFFSLAB)
list_for_each_entry_safe(sko,
n, &sks->sks_free_list, sko_list) {
@@ -437,8 +438,8 @@ spl_slab_free(spl_kmem_slab_t *sks,
static void
spl_slab_reclaim(spl_kmem_cache_t *skc)
{
- spl_kmem_slab_t *sks, *m;
- spl_kmem_obj_t *sko, *n;
+ spl_kmem_slab_t *sks = NULL, *m = NULL;
+ spl_kmem_obj_t *sko = NULL, *n = NULL;
LIST_HEAD(sks_list);
LIST_HEAD(sko_list);
uint32_t size = 0;
@@ -834,7 +835,7 @@ spl_magazine_free(spl_kmem_magazine_t *skm)
static int
spl_magazine_create(spl_kmem_cache_t *skc)
{
- int i;
+ int i = 0;
if (skc->skc_flags & KMC_NOMAGAZINE)
return (0);
@@ -865,7 +866,7 @@ static void
spl_magazine_destroy(spl_kmem_cache_t *skc)
{
spl_kmem_magazine_t *skm;
- int i;
+ int i = 0;
if (skc->skc_flags & KMC_NOMAGAZINE)
return;
@@ -1644,7 +1645,7 @@ static spl_shrinker_t
__spl_kmem_cache_generic_shrinker(struct shrinker *shrink,
struct shrink_control *sc)
{
- spl_kmem_cache_t *skc;
+ spl_kmem_cache_t *skc = NULL;
int alloc = 0;
/*
diff --git a/module/os/linux/spl/spl-kmem.c b/module/os/linux/spl/spl-kmem.c
index defbe80a2..b51e203ed 100644
--- a/module/os/linux/spl/spl-kmem.c
+++ b/module/os/linux/spl/spl-kmem.c
@@ -376,7 +376,7 @@ kmem_del_init(spinlock_t *lock, struct hlist_head *table,
int bits, const void *addr)
{
struct hlist_head *head;
- struct hlist_node *node;
+ struct hlist_node *node = NULL;
struct kmem_debug *p;
unsigned long flags;
@@ -573,7 +573,7 @@ static void
spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock)
{
unsigned long flags;
- kmem_debug_t *kd;
+ kmem_debug_t *kd = NULL;
char str[17];
spin_lock_irqsave(lock, flags);
diff --git a/module/os/linux/spl/spl-kstat.c b/module/os/linux/spl/spl-kstat.c
index 5cc21dca0..75565d082 100644
--- a/module/os/linux/spl/spl-kstat.c
+++ b/module/os/linux/spl/spl-kstat.c
@@ -431,7 +431,7 @@ static struct seq_operations kstat_seq_ops = {
static kstat_module_t *
kstat_find_module(char *name)
{
- kstat_module_t *module;
+ kstat_module_t *module = NULL;
list_for_each_entry(module, &kstat_module_list, ksm_module_list) {
if (strncmp(name, module->ksm_name, KSTAT_STRLEN) == 0)
@@ -624,7 +624,7 @@ static int
kstat_detect_collision(kstat_proc_entry_t *kpep)
{
kstat_module_t *module;
- kstat_proc_entry_t *tmp;
+ kstat_proc_entry_t *tmp = NULL;
char *parent;
char *cp;
@@ -659,7 +659,7 @@ kstat_proc_entry_install(kstat_proc_entry_t *kpep, mode_t mode,
const struct file_operations *file_ops, void *data)
{
kstat_module_t *module;
- kstat_proc_entry_t *tmp;
+ kstat_proc_entry_t *tmp = NULL;
ASSERT(kpep);
diff --git a/module/os/linux/spl/spl-proc.c b/module/os/linux/spl/spl-proc.c
index f4e0e0594..45bc7f963 100644
--- a/module/os/linux/spl/spl-proc.c
+++ b/module/os/linux/spl/spl-proc.c
@@ -144,7 +144,7 @@ proc_doslab(struct ctl_table *table, int write,
int rc = 0;
unsigned long min = 0, max = ~0, val = 0, mask;
spl_ctl_table dummy = *table;
- spl_kmem_cache_t *skc;
+ spl_kmem_cache_t *skc = NULL;
dummy.data = &val;
dummy.proc_handler = &proc_dointvec;
@@ -249,7 +249,7 @@ static int
taskq_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag)
{
taskq_t *tq = p;
- taskq_thread_t *tqt;
+ taskq_thread_t *tqt = NULL;
spl_wait_queue_entry_t *wq;
struct task_struct *tsk;
taskq_ent_t *tqe;
diff --git a/module/os/linux/spl/spl-taskq.c b/module/os/linux/spl/spl-taskq.c
index a01c4b475..4df44ade8 100644
--- a/module/os/linux/spl/spl-taskq.c
+++ b/module/os/linux/spl/spl-taskq.c
@@ -83,7 +83,7 @@ task_km_flags(uint_t flags)
static int
taskq_find_by_name(const char *name)
{
- struct list_head *tql;
+ struct list_head *tql = NULL;
taskq_t *tq;
list_for_each_prev(tql, &tq_list) {
@@ -212,7 +212,7 @@ task_expire_impl(taskq_ent_t *t)
{
taskq_ent_t *w;
taskq_t *tq = t->tqent_taskq;
- struct list_head *l;
+ struct list_head *l = NULL;
unsigned long flags;
spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class);
@@ -301,7 +301,7 @@ static void
taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt)
{
taskq_thread_t *w;
- struct list_head *l;
+ struct list_head *l = NULL;
ASSERT(tq);
ASSERT(tqt);
@@ -324,7 +324,7 @@ taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt)
static taskq_ent_t *
taskq_find_list(taskq_t *tq, struct list_head *lh, taskqid_t id)
{
- struct list_head *l;
+ struct list_head *l = NULL;
taskq_ent_t *t;
list_for_each(l, lh) {
@@ -350,7 +350,7 @@ static taskq_ent_t *
taskq_find(taskq_t *tq, taskqid_t id)
{
taskq_thread_t *tqt;
- struct list_head *l;
+ struct list_head *l = NULL;
taskq_ent_t *t;
t = taskq_find_list(tq, &tq->tq_delay_list, id);
@@ -1209,7 +1209,7 @@ param_set_taskq_kick(const char *val, struct kernel_param *kp)
#endif
{
int ret;
- taskq_t *tq;
+ taskq_t *tq = NULL;
taskq_ent_t *t;
unsigned long flags;
diff --git a/module/os/linux/spl/spl-tsd.c b/module/os/linux/spl/spl-tsd.c
index 14342d5a6..b955ed654 100644
--- a/module/os/linux/spl/spl-tsd.c
+++ b/module/os/linux/spl/spl-tsd.c
@@ -98,7 +98,7 @@ static tsd_hash_table_t *tsd_hash_table = NULL;
static tsd_hash_entry_t *
tsd_hash_search(tsd_hash_table_t *table, uint_t key, pid_t pid)
{
- struct hlist_node *node;
+ struct hlist_node *node = NULL;
tsd_hash_entry_t *entry;
tsd_hash_bin_t *bin;
ulong_t hash;
diff --git a/module/os/linux/spl/spl-vmem.c b/module/os/linux/spl/spl-vmem.c
index e1a84a911..a2630ecdd 100644
--- a/module/os/linux/spl/spl-vmem.c
+++ b/module/os/linux/spl/spl-vmem.c
@@ -50,7 +50,7 @@ EXPORT_SYMBOL(zio_arena);
size_t
vmem_size(vmem_t *vmp, int typemask)
{
- spl_kmem_cache_t *skc;
+ spl_kmem_cache_t *skc = NULL;
size_t alloc = VMEM_FLOOR_SIZE;
if ((typemask & VMEM_ALLOC) && (typemask & VMEM_FREE))