Jan Beulich
2010-Mar-25 09:32 UTC
[Xen-devel] [PATCH] linux: fix PCI resource reservation option parsing
Start looking for the second ''+'' after the first one (rather than at the beginning again). Also fail if second string cannot be parsed. Signed-off-by: Jan Beulich <jbeulich@novell.com> --- a/drivers/pci/reserve.c +++ b/drivers/pci/reserve.c @@ -60,16 +60,11 @@ static int pci_reserve_parse_one( p = strchr(str, ''+''); if (p == NULL) return -EINVAL; - p++; - if (pci_reserve_parse_size(p, io_size, mem_size)) + if (pci_reserve_parse_size(++p, io_size, mem_size)) return -EINVAL; - p = strchr(str, ''+''); - if (p != NULL) { - p++; - pci_reserve_parse_size(p, io_size, mem_size); - } - return 0; + p = strchr(p, ''+''); + return p ? pci_reserve_parse_size(p + 1, io_size, mem_size) : 0; } static unsigned long pci_reserve_size(struct pci_bus *pbus, int flags) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Isaku Yamahata
2010-Mar-25 09:54 UTC
[Xen-devel] Re: [PATCH] linux: fix PCI resource reservation option parsing
Looks good. Thank you. Acked-by: Isaku Yamahata <yamahata@valinux.co.jp> On Thu, Mar 25, 2010 at 09:32:17AM +0000, Jan Beulich wrote:> Start looking for the second ''+'' after the first one (rather than at > the beginning again). Also fail if second string cannot be parsed. > > Signed-off-by: Jan Beulich <jbeulich@novell.com> > > --- a/drivers/pci/reserve.c > +++ b/drivers/pci/reserve.c > @@ -60,16 +60,11 @@ static int pci_reserve_parse_one( > p = strchr(str, ''+''); > if (p == NULL) > return -EINVAL; > - p++; > - if (pci_reserve_parse_size(p, io_size, mem_size)) > + if (pci_reserve_parse_size(++p, io_size, mem_size)) > return -EINVAL; > > - p = strchr(str, ''+''); > - if (p != NULL) { > - p++; > - pci_reserve_parse_size(p, io_size, mem_size); > - } > - return 0; > + p = strchr(p, ''+''); > + return p ? pci_reserve_parse_size(p + 1, io_size, mem_size) : 0; > } > > static unsigned long pci_reserve_size(struct pci_bus *pbus, int flags) > > >-- yamahata _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel