Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751972AbdITIPy (ORCPT ); Wed, 20 Sep 2017 04:15:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51476 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751697AbdITIOA (ORCPT ); Wed, 20 Sep 2017 04:14:00 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 94C6881DE3 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH] KVM: x86: Fix the NULL pointer parameter in check_cr_write() To: Yu Zhang , Jim Mattson , David Hildenbrand Cc: kvm list , LKML , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" References: <1505731501-6821-1-git-send-email-yu.c.zhang@linux.intel.com> <62dd03f0-4049-1d9c-d07b-61cac4c49c93@redhat.com> <0a2a586b-5dd6-88cb-bd22-f0676b1c8fbe@linux.intel.com> From: Paolo Bonzini Message-ID: <0f652327-03f4-5fba-0717-d1f29e45d6cf@redhat.com> Date: Wed, 20 Sep 2017 10:13:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <0a2a586b-5dd6-88cb-bd22-f0676b1c8fbe@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 20 Sep 2017 08:14:00 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 599 Lines: 15 On 20/09/2017 08:35, Yu Zhang wrote: > > 2 reasons I did not choose to change kvm_cpuid(): 1> like Jim's > comments, kvm_cpuid() will eventually write the *eax - *edx no > matter a cpuid entry is found or not; 2> currently, return value of > kvm_cpuid() is either true when an entry is found or false otherwise. > We can change kvm_cpuid() to check the pointers of GPRs against NULL > and return false immediately. Then the false value would have 2 > different meanings - entry not found, or invalid params. > > Paolo, any suggestion? :-) Radim, has already sent this version to Linus. :) Paolo