From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark McLoughlin Subject: Re: [PATCH 3/4] KVM: gracefully handle zero in kvm_free_irq_source_id() Date: Mon, 01 Dec 2008 13:56:57 +0000 Message-ID: <1228139817.3870.30.camel@blaa> References: <1227867951.3643.24.camel@blaa> <1227867971-1716-1-git-send-email-markmc@redhat.com> <1227867971-1716-2-git-send-email-markmc@redhat.com> <1227867971-1716-3-git-send-email-markmc@redhat.com> <49326AB5.2050807@redhat.com> Reply-To: Mark McLoughlin Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Sheng Yang To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:33848 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751122AbYLAN6R (ORCPT ); Mon, 1 Dec 2008 08:58:17 -0500 In-Reply-To: <49326AB5.2050807@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, 2008-11-30 at 12:28 +0200, Avi Kivity wrote: > Mark McLoughlin wrote: > > Allow kvm_free_irq_source_id() to be called with a zero ID. > > > > Zero is reserved for KVM_USERSPACE_IRQ_SOURCE_ID, so we can > > guarantee that kvm_request_irq_source_id() will never return > > zero and use zero to indicate "no source ID allocated". > > > > > > Zero is a legal value for irq source ids, overloading it as something > else is confusing. Fair enough; I choose zero because it's naturally initialised to that by the kzalloc(). But I prefer explicit initialisation anyway, so ... > Things should continue to work if we #define it to 17. Okay, let's try with -1 then. > > + ASSERT(irq_source_id != 0); /* KVM_USERSPACE_IRQ_SOURCE_ID reserved */ > > > > Why not replace 0 with the actual symbolic constant? Because I was giving 0 two meanings :-) Respin of the patches coming up. Cheers, Mark.