From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M5pHT-0003Z3-3N for qemu-devel@nongnu.org; Sun, 17 May 2009 18:56:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M5pHO-0003Xk-GV for qemu-devel@nongnu.org; Sun, 17 May 2009 18:56:30 -0400 Received: from [199.232.76.173] (port=55181 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M5pHO-0003Xh-B1 for qemu-devel@nongnu.org; Sun, 17 May 2009 18:56:26 -0400 Received: from mx2.redhat.com ([66.187.237.31]:55663) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M5pHN-0004GO-IU for qemu-devel@nongnu.org; Sun, 17 May 2009 18:56:25 -0400 Message-ID: <4A109614.1040608@redhat.com> Date: Mon, 18 May 2009 01:56:20 +0300 From: Avi Kivity MIME-Version: 1.0 References: <1242128454-19078-1-git-send-email-markmc@redhat.com> In-Reply-To: <1242128454-19078-1-git-send-email-markmc@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] kvm: work around supported cpuid ioctl() brokenness List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark McLoughlin Cc: Anthony Liguori , qemu-devel@nongnu.org Mark McLoughlin wrote: > KVM_GET_SUPPORTED_CPUID has been known to fail to return -E2BIG > when it runs out of entries. Detect this by always trying again > with a bigger table if the ioctl() fills the table. > > Looks good, except for > cpuid = (struct kvm_cpuid2 *)qemu_mallocz(size); > cpuid->nent = max; > r = kvm_ioctl(s, KVM_GET_SUPPORTED_CPUID, cpuid); > + if (r == 0 && cpuid->nent >= max) > + r = -E2BIG; > Missing braces. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.