mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-18 10:21:01 +03:00
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 <hutter2@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #9732
This commit is contained in:
parent
bf01567e4e
commit
363d7332f2
@ -649,7 +649,7 @@ static void __init
|
|||||||
spl_random_init(void)
|
spl_random_init(void)
|
||||||
{
|
{
|
||||||
uint64_t s[2];
|
uint64_t s[2];
|
||||||
int i;
|
int i = 0;
|
||||||
|
|
||||||
get_random_bytes(s, sizeof (s));
|
get_random_bytes(s, sizeof (s));
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ static spl_kmem_slab_t *
|
|||||||
spl_slab_alloc(spl_kmem_cache_t *skc, int flags)
|
spl_slab_alloc(spl_kmem_cache_t *skc, int flags)
|
||||||
{
|
{
|
||||||
spl_kmem_slab_t *sks;
|
spl_kmem_slab_t *sks;
|
||||||
spl_kmem_obj_t *sko, *n;
|
spl_kmem_obj_t *sko;
|
||||||
void *base, *obj;
|
void *base, *obj;
|
||||||
uint32_t obj_size, offslab_size = 0;
|
uint32_t obj_size, offslab_size = 0;
|
||||||
int i, rc = 0;
|
int i, rc = 0;
|
||||||
@ -356,6 +356,7 @@ spl_slab_alloc(spl_kmem_cache_t *skc, int flags)
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
if (rc) {
|
if (rc) {
|
||||||
|
spl_kmem_obj_t *n = NULL;
|
||||||
if (skc->skc_flags & KMC_OFFSLAB)
|
if (skc->skc_flags & KMC_OFFSLAB)
|
||||||
list_for_each_entry_safe(sko,
|
list_for_each_entry_safe(sko,
|
||||||
n, &sks->sks_free_list, sko_list) {
|
n, &sks->sks_free_list, sko_list) {
|
||||||
@ -405,8 +406,8 @@ spl_slab_free(spl_kmem_slab_t *sks,
|
|||||||
static void
|
static void
|
||||||
spl_slab_reclaim(spl_kmem_cache_t *skc)
|
spl_slab_reclaim(spl_kmem_cache_t *skc)
|
||||||
{
|
{
|
||||||
spl_kmem_slab_t *sks, *m;
|
spl_kmem_slab_t *sks = NULL, *m = NULL;
|
||||||
spl_kmem_obj_t *sko, *n;
|
spl_kmem_obj_t *sko = NULL, *n = NULL;
|
||||||
LIST_HEAD(sks_list);
|
LIST_HEAD(sks_list);
|
||||||
LIST_HEAD(sko_list);
|
LIST_HEAD(sko_list);
|
||||||
uint32_t size = 0;
|
uint32_t size = 0;
|
||||||
@ -802,7 +803,7 @@ spl_magazine_free(spl_kmem_magazine_t *skm)
|
|||||||
static int
|
static int
|
||||||
spl_magazine_create(spl_kmem_cache_t *skc)
|
spl_magazine_create(spl_kmem_cache_t *skc)
|
||||||
{
|
{
|
||||||
int i;
|
int i = 0;
|
||||||
|
|
||||||
if (skc->skc_flags & KMC_NOMAGAZINE)
|
if (skc->skc_flags & KMC_NOMAGAZINE)
|
||||||
return (0);
|
return (0);
|
||||||
@ -833,7 +834,7 @@ static void
|
|||||||
spl_magazine_destroy(spl_kmem_cache_t *skc)
|
spl_magazine_destroy(spl_kmem_cache_t *skc)
|
||||||
{
|
{
|
||||||
spl_kmem_magazine_t *skm;
|
spl_kmem_magazine_t *skm;
|
||||||
int i;
|
int i = 0;
|
||||||
|
|
||||||
if (skc->skc_flags & KMC_NOMAGAZINE)
|
if (skc->skc_flags & KMC_NOMAGAZINE)
|
||||||
return;
|
return;
|
||||||
@ -1617,7 +1618,7 @@ static spl_shrinker_t
|
|||||||
__spl_kmem_cache_generic_shrinker(struct shrinker *shrink,
|
__spl_kmem_cache_generic_shrinker(struct shrinker *shrink,
|
||||||
struct shrink_control *sc)
|
struct shrink_control *sc)
|
||||||
{
|
{
|
||||||
spl_kmem_cache_t *skc;
|
spl_kmem_cache_t *skc = NULL;
|
||||||
int alloc = 0;
|
int alloc = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -303,7 +303,7 @@ kmem_del_init(spinlock_t *lock, struct hlist_head *table,
|
|||||||
int bits, const void *addr)
|
int bits, const void *addr)
|
||||||
{
|
{
|
||||||
struct hlist_head *head;
|
struct hlist_head *head;
|
||||||
struct hlist_node *node;
|
struct hlist_node *node = NULL;
|
||||||
struct kmem_debug *p;
|
struct kmem_debug *p;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
@ -500,7 +500,7 @@ static void
|
|||||||
spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock)
|
spl_kmem_fini_tracking(struct list_head *list, spinlock_t *lock)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
kmem_debug_t *kd;
|
kmem_debug_t *kd = NULL;
|
||||||
char str[17];
|
char str[17];
|
||||||
|
|
||||||
spin_lock_irqsave(lock, flags);
|
spin_lock_irqsave(lock, flags);
|
||||||
|
@ -431,7 +431,7 @@ static struct seq_operations kstat_seq_ops = {
|
|||||||
static kstat_module_t *
|
static kstat_module_t *
|
||||||
kstat_find_module(char *name)
|
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) {
|
list_for_each_entry(module, &kstat_module_list, ksm_module_list) {
|
||||||
if (strncmp(name, module->ksm_name, KSTAT_STRLEN) == 0)
|
if (strncmp(name, module->ksm_name, KSTAT_STRLEN) == 0)
|
||||||
@ -624,7 +624,7 @@ static int
|
|||||||
kstat_detect_collision(kstat_proc_entry_t *kpep)
|
kstat_detect_collision(kstat_proc_entry_t *kpep)
|
||||||
{
|
{
|
||||||
kstat_module_t *module;
|
kstat_module_t *module;
|
||||||
kstat_proc_entry_t *tmp;
|
kstat_proc_entry_t *tmp = NULL;
|
||||||
char *parent;
|
char *parent;
|
||||||
char *cp;
|
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)
|
const struct file_operations *file_ops, void *data)
|
||||||
{
|
{
|
||||||
kstat_module_t *module;
|
kstat_module_t *module;
|
||||||
kstat_proc_entry_t *tmp;
|
kstat_proc_entry_t *tmp = NULL;
|
||||||
|
|
||||||
ASSERT(kpep);
|
ASSERT(kpep);
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ proc_doslab(struct ctl_table *table, int write,
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
unsigned long min = 0, max = ~0, val = 0, mask;
|
unsigned long min = 0, max = ~0, val = 0, mask;
|
||||||
spl_ctl_table dummy = *table;
|
spl_ctl_table dummy = *table;
|
||||||
spl_kmem_cache_t *skc;
|
spl_kmem_cache_t *skc = NULL;
|
||||||
|
|
||||||
dummy.data = &val;
|
dummy.data = &val;
|
||||||
dummy.proc_handler = &proc_dointvec;
|
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_seq_show_impl(struct seq_file *f, void *p, boolean_t allflag)
|
||||||
{
|
{
|
||||||
taskq_t *tq = p;
|
taskq_t *tq = p;
|
||||||
taskq_thread_t *tqt;
|
taskq_thread_t *tqt = NULL;
|
||||||
spl_wait_queue_entry_t *wq;
|
spl_wait_queue_entry_t *wq;
|
||||||
struct task_struct *tsk;
|
struct task_struct *tsk;
|
||||||
taskq_ent_t *tqe;
|
taskq_ent_t *tqe;
|
||||||
|
@ -82,7 +82,7 @@ task_km_flags(uint_t flags)
|
|||||||
static int
|
static int
|
||||||
taskq_find_by_name(const char *name)
|
taskq_find_by_name(const char *name)
|
||||||
{
|
{
|
||||||
struct list_head *tql;
|
struct list_head *tql = NULL;
|
||||||
taskq_t *tq;
|
taskq_t *tq;
|
||||||
|
|
||||||
list_for_each_prev(tql, &tq_list) {
|
list_for_each_prev(tql, &tq_list) {
|
||||||
@ -211,7 +211,7 @@ task_expire_impl(taskq_ent_t *t)
|
|||||||
{
|
{
|
||||||
taskq_ent_t *w;
|
taskq_ent_t *w;
|
||||||
taskq_t *tq = t->tqent_taskq;
|
taskq_t *tq = t->tqent_taskq;
|
||||||
struct list_head *l;
|
struct list_head *l = NULL;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class);
|
spin_lock_irqsave_nested(&tq->tq_lock, flags, tq->tq_lock_class);
|
||||||
@ -298,7 +298,7 @@ static void
|
|||||||
taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt)
|
taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt)
|
||||||
{
|
{
|
||||||
taskq_thread_t *w;
|
taskq_thread_t *w;
|
||||||
struct list_head *l;
|
struct list_head *l = NULL;
|
||||||
|
|
||||||
ASSERT(tq);
|
ASSERT(tq);
|
||||||
ASSERT(tqt);
|
ASSERT(tqt);
|
||||||
@ -321,7 +321,7 @@ taskq_insert_in_order(taskq_t *tq, taskq_thread_t *tqt)
|
|||||||
static taskq_ent_t *
|
static taskq_ent_t *
|
||||||
taskq_find_list(taskq_t *tq, struct list_head *lh, taskqid_t id)
|
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;
|
taskq_ent_t *t;
|
||||||
|
|
||||||
list_for_each(l, lh) {
|
list_for_each(l, lh) {
|
||||||
@ -347,7 +347,7 @@ static taskq_ent_t *
|
|||||||
taskq_find(taskq_t *tq, taskqid_t id)
|
taskq_find(taskq_t *tq, taskqid_t id)
|
||||||
{
|
{
|
||||||
taskq_thread_t *tqt;
|
taskq_thread_t *tqt;
|
||||||
struct list_head *l;
|
struct list_head *l = NULL;
|
||||||
taskq_ent_t *t;
|
taskq_ent_t *t;
|
||||||
|
|
||||||
t = taskq_find_list(tq, &tq->tq_delay_list, id);
|
t = taskq_find_list(tq, &tq->tq_delay_list, id);
|
||||||
@ -1198,7 +1198,7 @@ param_set_taskq_kick(const char *val, struct kernel_param *kp)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
taskq_t *tq;
|
taskq_t *tq = NULL;
|
||||||
taskq_ent_t *t;
|
taskq_ent_t *t;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ static tsd_hash_table_t *tsd_hash_table = NULL;
|
|||||||
static tsd_hash_entry_t *
|
static tsd_hash_entry_t *
|
||||||
tsd_hash_search(tsd_hash_table_t *table, uint_t key, pid_t pid)
|
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_entry_t *entry;
|
||||||
tsd_hash_bin_t *bin;
|
tsd_hash_bin_t *bin;
|
||||||
ulong_t hash;
|
ulong_t hash;
|
||||||
|
@ -50,7 +50,7 @@ EXPORT_SYMBOL(zio_arena);
|
|||||||
size_t
|
size_t
|
||||||
vmem_size(vmem_t *vmp, int typemask)
|
vmem_size(vmem_t *vmp, int typemask)
|
||||||
{
|
{
|
||||||
spl_kmem_cache_t *skc;
|
spl_kmem_cache_t *skc = NULL;
|
||||||
size_t alloc = VMEM_FLOOR_SIZE;
|
size_t alloc = VMEM_FLOOR_SIZE;
|
||||||
|
|
||||||
if ((typemask & VMEM_ALLOC) && (typemask & VMEM_FREE))
|
if ((typemask & VMEM_ALLOC) && (typemask & VMEM_FREE))
|
||||||
|
Loading…
Reference in New Issue
Block a user