xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] linux: fix PCI resource reservation option parsing
@ 2010-03-25  9:32 Jan Beulich
  2010-03-25  9:54 ` Isaku Yamahata
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2010-03-25  9:32 UTC (permalink / raw)
  To: xen-devel; +Cc: Isaku Yamahata

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] linux: fix PCI resource reservation option parsing
  2010-03-25  9:32 [PATCH] linux: fix PCI resource reservation option parsing Jan Beulich
@ 2010-03-25  9:54 ` Isaku Yamahata
  0 siblings, 0 replies; 2+ messages in thread
From: Isaku Yamahata @ 2010-03-25  9:54 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-25  9:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-25  9:32 [PATCH] linux: fix PCI resource reservation option parsing Jan Beulich
2010-03-25  9:54 ` Isaku Yamahata

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).