From: "Jan Beulich" Subject: [PATCH] linux: fix PCI resource reservation option parsing Date: Thu, 25 Mar 2010 09:32:17 +0000 Message-ID: <4BAB3BB10200007800036DDD@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Isaku Yamahata List-Id: xen-devel@lists.xenproject.org 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 --- a/drivers/pci/reserve.c +++ b/drivers/pci/reserve.c @@ -60,16 +60,11 @@ static int pci_reserve_parse_one( p =3D strchr(str, '+'); if (p =3D=3D 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; =20 - p =3D strchr(str, '+'); - if (p !=3D NULL) { - p++; - pci_reserve_parse_size(p, io_size, mem_size); - } - return 0; + p =3D strchr(p, '+'); + return p ? pci_reserve_parse_size(p + 1, io_size, mem_size) : 0; } =20 static unsigned long pci_reserve_size(struct pci_bus *pbus, int flags)