From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v5 p2 01/19] xen/arm: Let the toolstack configure the number of SPIs Date: Thu, 16 Apr 2015 15:39:39 +0100 Message-ID: <1429195179.25195.138.camel@citrix.com> References: <1428592185-18581-1-git-send-email-julien.grall@citrix.com> <1428592185-18581-2-git-send-email-julien.grall@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YikxE-0008QB-NQ for xen-devel@lists.xenproject.org; Thu, 16 Apr 2015 14:39:44 +0000 In-Reply-To: <1428592185-18581-2-git-send-email-julien.grall@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: Wei Liu , Ian Jackson , Julien Grall , tim@xen.org, stefano.stabellini@citrix.com, Jan Beulich , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Thu, 2015-04-09 at 16:09 +0100, Julien Grall wrote: > From: Julien Grall > > Each domain may have a different number of IRQs depending on the devices > assigned to it. > Rather re-using the number of IRQs used by the hardwared GIC, let the ^than > toolstack specify the number of SPIs when the domain is created. This > will avoid to waste memory. "will avoid wasting memory." > + /* Limit the number of virtual SPIs supported to (1020 - 32) = 988 */ > + if ( (nr_spis + NR_LOCAL_IRQS) > 1020 ) > + return -EINVAL; If there's any chance this can be called by not-completely trusted code (e.g. a disaggregated toolstack) then this if susceptible to an overflow (sorry, I gave you this code in a previous rev). I think you can just move the NR_LOCAL_IRQS to the other side of the expression, i.e. if ( nr_spis > 1020 - NR_LOCAL_IRQS ) With that and the grammar fixed: Acked-by: Ian Campbell Ian.