From: Ian Campbell Subject: Re: [Xen-users] Xen 4.2 TODO (io and irq parameter are not evaluated by xl) Date: Fri, 31 Aug 2012 16:23:39 +0100 Message-ID: <1346426619.27277.237.camel@zakaz.uk.xensource.com> References: <1344935141.5926.6.camel@zakaz.uk.xensource.com> <20120814100704.GA19704@bloms.de> <1346421542.27277.218.camel@zakaz.uk.xensource.com> <1346425278.27277.224.camel@zakaz.uk.xensource.com> <20544.54424.775548.66532@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20544.54424.775548.66532@mariner.uk.xensource.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 Jackson Cc: Dieter Bloms , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Fri, 2012-08-31 at 16:13 +0100, Ian Jackson wrote: > Ian Campbell writes ("Re: [Xen-users] Xen 4.2 TODO (io and irq parameter are not evaluated by xl)"): > > libxl/xl: implement support for guest iooprt and irq permissions. > > Most of this looks good, but: > > ... ("bios", libxl_bios_type), > > + buf = xlu_cfg_get_listitem (ioports, i); > > + if (!buf) { > > + fprintf(stderr, > > + "xl: Unable to get element #%d in ioport list\n", i); > > + exit(1); > > + } > > + s = e = strtoul(buf, &ep, 16); > > + if (ep == buf) { > > + fprintf(stderr, "xl: Invalid argument parsing ioport: %s\n", > > + buf); > > + exit(1); > > + } > > + if (*ep == '-') { > > This code fails to properly handle (reject) > - (*ep!=0 && *ep!='-') Oops, will fix. > - value > LONG_MAX > - INT_MAX < value <= LONG_MAX These all get checked inside the (eventual) hypercall. Or were you thinking of something else? BTW the types should be unsigned all the way down, unless I've screwed something up. > - *ep2!=0 Will fix. > > > + irq = strtoul(buf, &ep, 10); > > Likewise. > > I take it we're not worrying about missing malloc failure checks in > xl. Seems like we do elsewhere, so I might as well fix this. Ian.