Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1193223pxb; Fri, 21 Jan 2022 11:57:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQUgE+t+Kf5QwHb82HwU9wjRo6vQDh8sLoVk+RhRI/Abvor9LrEydx2JhzrqF73LIuPcxh X-Received: by 2002:a62:15d0:0:b0:4c5:9481:705d with SMTP id 199-20020a6215d0000000b004c59481705dmr5123681pfv.40.1642795052085; Fri, 21 Jan 2022 11:57:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642795052; cv=none; d=google.com; s=arc-20160816; b=vY7TOQbk43ZfzL/Z+MJvBCp+5JGL3FmAKK3z/184ayw14ZXCdIMIrE3OVdGQFOevg8 rtsfwTiv6GkAIJ9wHyzJ9eOhQAqA4ouPIk2eOAiderPY4DmEB5ebLIbk6KzzryyTBzXT D8hvep41loMB7QkR4nNqKe0VLFot/sJjeAqnB+YFcqXQh/+RSrUsGus4o4E1ZTUYbRIk KTmtGotWi2ilDMajFR7MsV+gPZ3RayqxFFpkZWwrnIGSQ1rzhESSmrpvwA/EliLVfYya jJQlFG+AXsRkvt299ZDLG/R3WZOX3XOZpLjCAPUSUL5aqfdx1HrXHE6wt5gdHCSZPCGP U6sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=yEREuIwhli7iJjgFoyBi+FO+07r4F6yeofjnLnMk0U8=; b=dJVwqp5OfHDDC2B57RwZsMjpwXYUYkFvwcjMHAVApVZcUsUfbKKeoUAaga+wWr1ijE nuiUylhLxnhCus0VIn5LV0xcrz22HwmP0iwOaUTNA5Gt9v41AdtIIIiUoUkOofNpFLnA p8QgJXm56nL7cc0R+TSiuNR7fMnoLW2x4hoqP57skbd9KA6rQX8CGmRNSSzXA3ler/Ut J4D3GDVs1ezdGXKeyOutB6yXtTOMT0EOBd1sufJnwmcSiwxrjT5NL7CMEkf3MAUb/jvc 0l02jTK8GlWrk+M4S5k6PWaNTM/9anGgqxmhnpEEIpuSV8MHpbmZvnkRWIUItS9IGq// Kjhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LIbir6FQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bj23si1050156pgb.127.2022.01.21.11.57.20; Fri, 21 Jan 2022 11:57:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LIbir6FQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356723AbiASSh5 (ORCPT + 99 others); Wed, 19 Jan 2022 13:37:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:59078 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356825AbiASShz (ORCPT ); Wed, 19 Jan 2022 13:37:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642617475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yEREuIwhli7iJjgFoyBi+FO+07r4F6yeofjnLnMk0U8=; b=LIbir6FQ2mxNJqG95L+m2hbJigaYPq+7UhKORcHpx49QXOfZorbEeWUOcFVYsq+09P0mZi B7tEtDcE99V3fhJTUbkLeldkhby0GPo3wvZG/VUyF+qx++RZMC8HuvszyA9t3+/fUBUJNX 2v5BaxREyVfqyepwXJ8sUyl8jHMd9o0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-613-d2SZZewOOleNv4eZ-loTWg-1; Wed, 19 Jan 2022 13:37:53 -0500 X-MC-Unique: d2SZZewOOleNv4eZ-loTWg-1 Received: by mail-wm1-f72.google.com with SMTP id f187-20020a1c38c4000000b0034d5c66d8f5so2448847wma.5 for ; Wed, 19 Jan 2022 10:37:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=yEREuIwhli7iJjgFoyBi+FO+07r4F6yeofjnLnMk0U8=; b=OexKMTktQrAYCb7vdV442Z12HBp4njQbO1WiwoRH8Lw/lAz5QUWaoB7uGnEsxJbwrz XNYC7OC0kf0T6o38H4377Li9+SL5BL97j1nI0os+cCwc4tN+53jBNLGk1MQaZKPWUtXe 26uDo6J9G0IIQwksFNEDL/1YBGly35vWrN0g0mMTskrPqWX4zW8w8WVE9KT/qoNThe62 2Ls/QfqEdcZUJwpTSIyNVBLf37QQVZPFzNl/KQ/McQ5tweks937amAsRekX6qyP3dyJU 1KKvNE129LwN8oglOnPS3lyfjx5vUwVEVwMGQWSFybWBHEIjm1Oh1q68tssxUq9CUhm6 e8xw== X-Gm-Message-State: AOAM530qzDTUxDZ7oTif7aQZdiwzavutDsZZ7X+Np4JNGg5QQF7ltxrx aW2I/tLklLOfyiE2kXsiQvJ7VULXWJfB9UT83srNNJDeZ48zsnbD6Zj/qHqLvjBjWWNCG4JynJ9 xpOK8YTcuQpWp5nCZRpmDniIf X-Received: by 2002:a5d:4404:: with SMTP id z4mr14188671wrq.227.1642617472729; Wed, 19 Jan 2022 10:37:52 -0800 (PST) X-Received: by 2002:a5d:4404:: with SMTP id z4mr14188657wrq.227.1642617472536; Wed, 19 Jan 2022 10:37:52 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.googlemail.com with ESMTPSA id n14sm590533wri.101.2022.01.19.10.37.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Jan 2022 10:37:51 -0800 (PST) Message-ID: Date: Wed, 19 Jan 2022 19:37:50 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH] selftests: kvm/x86: Fix the warning in lib/x86_64/processor.c Content-Language: en-US To: Jinrong Liang Cc: Wanpeng Li , Sean Christopherson , Jim Mattson , Vitaly Kuznetsov , Joerg Roedel , Jinrong Liang , kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220119140325.59369-1-cloudliang@tencent.com> From: Paolo Bonzini In-Reply-To: <20220119140325.59369-1-cloudliang@tencent.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/19/22 15:03, Jinrong Liang wrote: > From: Jinrong Liang > > The following warning appears when executing > make -C tools/testing/selftests/kvm > > In file included from lib/x86_64/processor.c:11: > lib/x86_64/processor.c: In function ': > include/x86_64/processor.h:290:2: warning: 'ecx' may be used uninitialized in this > function [-Wmaybe-uninitialized] > asm volatile("cpuid" > ^~~ > lib/x86_64/processor.c:1523:21: note: 'ecx' was declared here > uint32_t eax, ebx, ecx, edx, max_ext_leaf; > > Just initialize ecx to remove this warning. > > Fixes: c8cc43c1eae2 ("selftests: KVM: avoid failures due to reserved > HyperTransport region") > > Signed-off-by: Jinrong Liang > --- > tools/testing/selftests/kvm/lib/x86_64/processor.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/testing/selftests/kvm/lib/x86_64/processor.c > index 59dcfe1967cc..4a4c7945cf3e 100644 > --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c > +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c > @@ -1520,7 +1520,7 @@ unsigned long vm_compute_max_gfn(struct kvm_vm *vm) > { > const unsigned long num_ht_pages = 12 << (30 - vm->page_shift); /* 12 GiB */ > unsigned long ht_gfn, max_gfn, max_pfn; > - uint32_t eax, ebx, ecx, edx, max_ext_leaf; > + uint32_t eax, ebx, ecx = 0, edx, max_ext_leaf; > > max_gfn = (1ULL << (vm->pa_bits - vm->page_shift)) - 1; > A separate assignment of "ecx = 0" is slightly more conforming to the coding standards. Queued nevertheless, thanks. Paolo