From patchwork Fri Dec 6 03:26:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Yang X-Patchwork-Id: 1204921 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47TdMN5brTz9sPW for ; Fri, 6 Dec 2019 14:28:00 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 30F8620390; Fri, 6 Dec 2019 03:27:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JVdsR7rFh4Ek; Fri, 6 Dec 2019 03:27:58 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 0310B20385; Fri, 6 Dec 2019 03:27:58 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E75EDC1D7C; Fri, 6 Dec 2019 03:27:57 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id EA20AC1D7C for ; Fri, 6 Dec 2019 03:27:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id D689388A06 for ; Fri, 6 Dec 2019 03:27:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4cpFBfRy-R+h for ; Fri, 6 Dec 2019 03:27:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by hemlock.osuosl.org (Postfix) with ESMTP id D441C889EC for ; Fri, 6 Dec 2019 03:27:55 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 295F81FB; Thu, 5 Dec 2019 19:27:55 -0800 (PST) Received: from nfv-demo01.shanghai.arm.com (nfv-demo01.shanghai.arm.com [10.169.41.196]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 00C3E3F68E; Thu, 5 Dec 2019 19:27:51 -0800 (PST) From: Lance Yang To: ovs-dev@openvswitch.org Date: Fri, 6 Dec 2019 11:26:11 +0800 Message-Id: <1575602773-11901-2-git-send-email-Lance.Yang@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1575602773-11901-1-git-send-email-Lance.Yang@arm.com> References: <1575602773-11901-1-git-send-email-Lance.Yang@arm.com> Cc: Jieqiang.Wang@arm.com, Ruifeng.Wang@arm.com, Gavin.Hu@arm.com, i.maximets@ovn.org, nd@arm.com Subject: [ovs-dev] [PATCH v2 1/3] dpif-netdev-perf: Fix using of unitialized last_tsc X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" When compiling Open vSwitch on aarch64, the compiler will warn about an uninitailized variable in lib/dpif-netdev-perf.c. If the clock_gettime function in rdtsc_syscall fails, the member last_tsc of the unitialized struct will be returned. In order to avoid the warnings, it is necessary to initialize the variable before using. Reviewed-by: Yanqin Wei Reviewed-by: Malvika Gupta Signed-off-by: Lance Yang --- lib/dpif-netdev-perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dpif-netdev-perf.c b/lib/dpif-netdev-perf.c index baf90b0..58728ab 100644 --- a/lib/dpif-netdev-perf.c +++ b/lib/dpif-netdev-perf.c @@ -76,7 +76,7 @@ pmd_perf_estimate_tsc_frequency(void) break; } } - + memset(&s, 0, sizeof s); start = cycles_counter_update(&s); /* Using xnanosleep as it's interrupt resistant. * Sleeping only 100 ms to avoid holding the main thread for too long. */