浏览代码

rhashtable: initialize atomic nelems variable

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Cc: Thomas Graf <tgraf@suug.ch>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Ying Xue 10 年之前
父节点
当前提交
545a148e43
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      lib/rhashtable.c

+ 1 - 0
lib/rhashtable.c

@@ -847,6 +847,7 @@ int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params)
 	if (tbl == NULL)
 	if (tbl == NULL)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
+	atomic_set(&ht->nelems, 0);
 	atomic_set(&ht->shift, ilog2(tbl->size));
 	atomic_set(&ht->shift, ilog2(tbl->size));
 	RCU_INIT_POINTER(ht->tbl, tbl);
 	RCU_INIT_POINTER(ht->tbl, tbl);
 	RCU_INIT_POINTER(ht->future_tbl, tbl);
 	RCU_INIT_POINTER(ht->future_tbl, tbl);