From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id ECF3AA0352; Mon, 4 Nov 2019 14:48:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4DD99378E; Mon, 4 Nov 2019 14:48:08 +0100 (CET) Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by dpdk.org (Postfix) with ESMTP id 85BB8374E for ; Mon, 4 Nov 2019 14:48:06 +0100 (CET) Received: by mail-lj1-f194.google.com with SMTP id 139so17709402ljf.1 for ; Mon, 04 Nov 2019 05:48:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=PVurKkZtB8dHwJS6vdMaPS8kYrvEVXYkdnAvVQ8G3Gc=; b=OMSHNffJcVlm8WNXw/x23K12UCHTHqtKoEdr+4kS/Y9Js7hupq8iB/FG1SykuaaTeg jsA1wRbVHSP82J3UY4sOCMURQGEYNaD3NWRGhGbKb/zFLLsm007VK/fXv/9D51VR48zO NVASrxuBVyA5H8bpxoffZl5YlwAWXGEqFzFGMh3NcnZJQdWCWvnMDQvmZmnP/VkV0AOf UKqiAW3tGbpPONeEHpQ28dD8t7UWqAYxFEXYmkS/xkztpd6SOI/Ow6IB4fPohPngGt+z 48gT8aEcbTIfjxbHm2XKoenlZzeVD+u0ff4Hg1Q3fi9iAAosvM3++wY2s7QC6P2u9Z14 /N7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PVurKkZtB8dHwJS6vdMaPS8kYrvEVXYkdnAvVQ8G3Gc=; b=UM/Y16BZyxcNASymJulEGjy6xhuU9SrKpHptPuARp1OTrTJJ8YvKoqU1rNbVTDY/SK Rxqq/AOntCxM0NkTHHzmKlqzGQ0TcysO39LQzi7k4+rRleP9e032jxQQ5ul3kuVxRWee pLFzP1XDEoZ+25i2hoekrPaBZ2TX4MJe4u0y3kQaG4lY6jT002kUWSGGNUbPMxwmx/al geAOx0Pm1ySpLssHlkYk4r/N1+Mqtxt3pp7Ucd7i1YttifsUknn1wj8p758No98YmAfj agZZ1KSGn7K6xAqybl8tIbuD9pjUl0ifSsu2jxrR6gUC6oPljF20I8GTFhMNnuN/07X0 e2FA== X-Gm-Message-State: APjAAAXDDdVqjrpi8NfDr7RTlmM65E1tN7+uUEyFl0xrCxDvcADNqxn5 +OIVKnMDexyRqGsqBvl19EaN4g== X-Google-Smtp-Source: APXvYqz6pAxeiUBE4/gDaEIf8dH+C3+aGtlxPI3y0h00crXXAz12pD4moDu4mXhvtNBeoS+jwQdVoA== X-Received: by 2002:a2e:7a04:: with SMTP id v4mr6108703ljc.106.1572875285720; Mon, 04 Nov 2019 05:48:05 -0800 (PST) Received: from [10.0.0.72] (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id r22sm6806666ljk.31.2019.11.04.05.48.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Nov 2019 05:48:04 -0800 (PST) To: "Wang, Yipeng1" , "dev@dpdk.org" , "Gobriel, Sameh" , "Richardson, Bruce" , Chas Williams , "Burakov, Anatoly" Cc: "mattias.ronnblom@ericsson.com" , "stephen@networkplumber.org" References: <20191028142145.3758-1-aostruszka@marvell.com> <20191029141212.4907-1-aostruszka@marvell.com> <20191029141212.4907-8-aostruszka@marvell.com> From: Andrzej Ostruszka Message-ID: Date: Mon, 4 Nov 2019 14:48:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v6 07/12] app/test: clean LTO build warnings (maybe-uninitialized) 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Yipeng Thank you for your comment. See my reply below. On 11/1/19 6:15 PM, Wang, Yipeng1 wrote: >> -----Original Message----- [...] >> diff --git a/app/test/test_hash_readwrite.c b/app/test/test_hash_readwrite.c >> index 4376b099b..615767fb6 100644 >> --- a/app/test/test_hash_readwrite.c >> +++ b/app/test/test_hash_readwrite.c >> @@ -298,7 +298,7 @@ test_rw_reader(void *arg) >> >> begin = rte_rdtsc_precise(); >> for (i = 0; i < read_cnt; i++) { >> - void *data; >> + void *data = arg; > > [Wang, Yipeng] > Hi Andrzej, thanks for the fix! Maybe you could initialize the data to be "NULL"? > I think it makes more sense to be NULL rather than arg. That actually is not a good idea. The conditional test below does not check return value from lookup and expects the returned pointer to data to be equal to the iteration count (these pointers do not point at anything). For the first loop iteration "data = NULL" could miss the problem of the key not being in the hash (key not in the hash, return value not checked but the pointer "data" is NULL as we expected since i = 0). What I used is a bit hackish - I assumed that arg pointer (which is pointing to the "read_cnt") will not be within [0-read_cnt] address range. If that is too hackish then it would be better to rework this function to actually test for return value of hash lookup. Let me know what you think. Regards Andrzej