From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from m12-17.163.com (m12-17.163.com [220.181.12.17]) by dpdk.org (Postfix) with ESMTP id BC4021B571 for ; Sat, 22 Dec 2018 13:27:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=b02+xEC/h5I/VMXvKz 0iMNmbndvszL3TAXV7B3Fix0o=; b=XKMWX/wtrRnrYCHsSBidDrWdSpqJfrIJpz aQYxHt9SfbsEQNdnDkcL0ZCVztwv3XVanT3JUvom5v9nBTiGeKv7P+h8/J4K5Qzl wQk5qw+8xEGFcjwOft/JQkZ7OkR7QjideSvqqzs3ZyVg6YKwXu21pA8ll3zgqWyu epYintnAE= Received: from localhost (unknown [14.17.22.40]) by smtp13 (Coremail) with SMTP id EcCowAC3WIzjKR5c9tILAQ--.14974S2; Sat, 22 Dec 2018 20:11:15 +0800 (CST) From: Haiyang Tan To: Cristian Dumitrescu Cc: dev@dpdk.org, Haiyang Tan Date: Sat, 22 Dec 2018 04:10:59 -0800 Message-Id: <20181222121100.52827-1-haiyangtan@tencent.com> X-Mailer: git-send-email 2.14.1 X-CM-TRANSID: EcCowAC3WIzjKR5c9tILAQ--.14974S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7tr1xtFy5JrW7Zw15XF45trb_yoW8WF13p3 yru34UKan8JF4FkrnrZan5trn8uFW2vw17tFyvgw40ywsFqr9YqF1UKryxWF9Yqa9xXr17 KFWIvw1UWr4F9FDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jjbyAUUUUU= X-Originating-IP: [14.17.22.40] Sender: thy295@163.com X-CM-SenderInfo: xwk1jmqv6rljoofrz/1tbiEAMlP1WBi74BmwAAsy Subject: [dpdk-dev] [PATCH] hash: fix possible uninitialized variable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Dec 2018 12:27:46 -0000 The uninitialized field 'extra_flag' of hash_cuckoo_params may enable certain feature silently. Typically, if bit0 of 'extra_flag' set, the hardware transactional memory support will be enabled unexpectedly. Signed-off-by: Haiyang Tan --- lib/librte_table/rte_table_hash_cuckoo.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/librte_table/rte_table_hash_cuckoo.c b/lib/librte_table/rte_table_hash_cuckoo.c index f02430333..25fc3a10b 100644 --- a/lib/librte_table/rte_table_hash_cuckoo.c +++ b/lib/librte_table/rte_table_hash_cuckoo.c @@ -82,6 +82,7 @@ rte_table_hash_cuckoo_create(void *params, uint32_t entry_size) { struct rte_table_hash_cuckoo_params *p = params; + struct rte_hash_parameters hash_cuckoo_params = { 0 }; struct rte_hash *h_table; struct rte_table_hash *t; uint32_t total_size; @@ -103,14 +104,12 @@ rte_table_hash_cuckoo_create(void *params, } /* Create cuckoo hash table */ - struct rte_hash_parameters hash_cuckoo_params = { - .entries = p->n_keys, - .key_len = p->key_size, - .hash_func = p->f_hash, - .hash_func_init_val = p->seed, - .socket_id = socket_id, - .name = p->name - }; + hash_cuckoo_params.entries = p->n_keys; + hash_cuckoo_params.key_len = p->key_size; + hash_cuckoo_params.hash_func = p->f_hash; + hash_cuckoo_params.hash_func_init_val = p->seed; + hash_cuckoo_params.socket_id = socket_id; + hash_cuckoo_params.name = p->name; h_table = rte_hash_find_existing(p->name); if (h_table == NULL) { -- 2.14.1