From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Date: Fri, 23 Jan 2015 17:50:41 +0000 Subject: Re: [patch] KVM: always initialize *pdata in get_msr() Message-Id: <54C289F1.7000009@redhat.com> List-Id: References: <20150123143232.GA4298@mwanda> In-Reply-To: <20150123143232.GA4298@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Dan Carpenter , Gleb Natapov Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, kernel-janitors@vger.kernel.org On 23/01/2015 15:32, Dan Carpenter wrote: > Smatch complains that there are some paths where we use uninitialized > data in em_sysenter(). > > arch/x86/kvm/emulate.c:2410 em_sysenter() > error: potentially using uninitialized 'msr_data'. The right thing to do is to ensure that the value is set if get_msr returns 0. If it returns 1, msr_data is not used. This one is obviously a false positive, so I'm not applying the patch for now. Paolo > A couple examples of paths which don't set "pdata" are found in > get_msr_hyperv() and kvm_x2apic_msr_read(). I looked at this code and > it seems like setting it to zero is a common default behaviour. > > Signed-off-by: Dan Carpenter > --- > From static analysis only, not from real life. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [patch] KVM: always initialize *pdata in get_msr() Date: Fri, 23 Jan 2015 18:50:41 +0100 Message-ID: <54C289F1.7000009@redhat.com> References: <20150123143232.GA4298@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, kvm@vger.kernel.org, kernel-janitors@vger.kernel.org To: Dan Carpenter , Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:37392 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756017AbbAWRuy (ORCPT ); Fri, 23 Jan 2015 12:50:54 -0500 In-Reply-To: <20150123143232.GA4298@mwanda> Sender: kvm-owner@vger.kernel.org List-ID: On 23/01/2015 15:32, Dan Carpenter wrote: > Smatch complains that there are some paths where we use uninitialized > data in em_sysenter(). > > arch/x86/kvm/emulate.c:2410 em_sysenter() > error: potentially using uninitialized 'msr_data'. The right thing to do is to ensure that the value is set if get_msr returns 0. If it returns 1, msr_data is not used. This one is obviously a false positive, so I'm not applying the patch for now. Paolo > A couple examples of paths which don't set "pdata" are found in > get_msr_hyperv() and kvm_x2apic_msr_read(). I looked at this code and > it seems like setting it to zero is a common default behaviour. > > Signed-off-by: Dan Carpenter > --- > From static analysis only, not from real life.