From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v5 p2 01/19] xen/arm: Let the toolstack configure the number of SPIs Date: Thu, 16 Apr 2015 16:10:07 +0100 Message-ID: <552FD0CF.7050906@citrix.com> References: <1428592185-18581-1-git-send-email-julien.grall@citrix.com> <1428592185-18581-2-git-send-email-julien.grall@citrix.com> <1429195179.25195.138.camel@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YilSn-00040I-9w for xen-devel@lists.xenproject.org; Thu, 16 Apr 2015 15:12:21 +0000 In-Reply-To: <1429195179.25195.138.camel@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: Ian Campbell , Julien Grall Cc: Wei Liu , tim@xen.org, Julien Grall , Ian Jackson , stefano.stabellini@citrix.com, Jan Beulich , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org Hi Ian, On 16/04/2015 15:39, Ian Campbell wrote: > 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). Hmmm, right. > 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 ) I will do the change and adding a pair of parentheses for more clarity: if ( nr_spis > (1020 - NR_LOCAL_IRQS) ) > With that and the grammar fixed: > Acked-by: Ian Campbell Thanks, -- Julien Grall