From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id E252D2C37 for ; Wed, 11 Oct 2017 14:49:24 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 7A1AD2156D; Wed, 11 Oct 2017 08:49:24 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Wed, 11 Oct 2017 08:49:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=D1WL8T8jZ03JyJ9qrTzOFBH+9i 4SAT4N+BMjH0LAjMw=; b=S9+qyMuWJc4zm3epjUelg18HFNAuLDYmZn+pe/xv31 kUZr3GM3Uul1cAfAfMlzbCwlxV7r0zEkMQlz1Zo6zGcq5owe+6aCS/CPrFj+ZkAR QMI5uDXjImux/Z+YA5TAY7MoE/Xgwgs8740X2tIFQ78Ufji4zssBwVuCsKoQWHJs s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=D1WL8T 8jZ03JyJ9qrTzOFBH+9i4SAT4N+BMjH0LAjMw=; b=oeaMg8bxbXRy7y2DvqDbXu QYbjlEEJXD5zh8JG45zMUIlxuhbQFijmHNqaO+9hP4CWmgfgdwXDbv09Q278G9GG 7i2HAjalyOfvpsaz/qNowxCZdlCELJpoK9OM6HPuDbitRuLG9D+0Ln3czm7ZkwjS P77xv6ZT+2+qVpTeNxrQZKndoOgiM1bDb5WNV5HXhAvgrYJ88tgIOWGwpi3XZ7Xv Moqw8sKjGmq3vtRcqIX4geGLWSDpGpfGOtLpWZQCjYaXIl5pjdCLzoFv7VRqtkN4 F0BIaQ8hWW4wQlTImk4Dfy7AUby/zHnCYzSwTiCAZ8VzHusZDf5sTLvU4whtBJUg == X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id F12497F91F; Wed, 11 Oct 2017 08:49:23 -0400 (EDT) From: Thomas Monjalon To: Bruce Richardson Cc: dev@dpdk.org, yliu@fridaylinux.org, Maxime Coquelin Date: Wed, 11 Oct 2017 14:49:23 +0200 Message-ID: <188478579.ZJIaHkYeo6@xps> In-Reply-To: <20171011112817.3357-1-bruce.richardson@intel.com> References: <20171011095907.229893-1-bruce.richardson@intel.com> <20171011112817.3357-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v2] vhost: fix false-positive warning from clang 5 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: Wed, 11 Oct 2017 12:49:25 -0000 11/10/2017 13:28, Bruce Richardson: > When compiling with clang extra warning flags, such as used by default with > meson, a warning is given in iotlb.c: > > ../lib/librte_vhost/iotlb.c:318:6: warning: variable 'socket' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] > > This is a false positive, as the socket value will be initialized by the > call to get_mempolicy in the case where the NUMA build-time flag is set, > and in cases where it is not set, "if (ret)" will always be true as ret is > initialized to -1 and never changed. > > However, this is not immediately obvious, and is perhaps a little fragile, > as it will break if other code using ret is subsequently added above the > call to get_mempolicy by someone unaware of this subtle dependency. > Therefore, we can fix the warning and making the code more robust by > explicitly initializing socket to zero, and moving the extra condition > check on the return from get_mempolicy() into the #ifdef > > Fixes: d012d1f293f4 ("vhost: add IOTLB helper functions") > > CC: Maxime Coquelin > Signed-off-by: Bruce Richardson Applied, thanks