public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] i386/x86-64: Return defined error value for bad PCI config space accesses
       [not found] <200604091900.k39J0uVn013016@hera.kernel.org>
@ 2006-04-09 19:17 ` Jeff Garzik
  2006-04-09 19:55   ` Andi Kleen
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Garzik @ 2006-04-09 19:17 UTC (permalink / raw)
  To: Andi Kleen, Andrew Morton; +Cc: Linux Kernel Mailing List

Linux Kernel Mailing List wrote:
> -	if (!value || (bus > 255) || (devfn > 255) || (reg > 255))
> +	if (!value || (bus > 255) || (devfn > 255) || (reg > 255)) {
> +		*value = -1;
>  		return -EINVAL;
> +	}
>  
>  	spin_lock_irqsave(&pci_config_lock, flags);
>  
> diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
> index 2002c74..f77d7f8 100644
> --- a/arch/i386/pci/mmconfig.c
> +++ b/arch/i386/pci/mmconfig.c
> @@ -80,8 +80,10 @@ static int pci_mmcfg_read(unsigned int s
>  	unsigned long flags;
>  	u32 base;
>  
> -	if (!value || (bus > 255) || (devfn > 255) || (reg > 4095))
> +	if (!value || (bus > 255) || (devfn > 255) || (reg > 4095)) {
> +		*value = -1;
>  		return -EINVAL;
> +	}
>  
>  	base = get_base_addr(seg, bus, devfn);
>  	if (!base)
> diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
> index d4e25f3..b493ed9 100644
> --- a/arch/x86_64/pci/mmconfig.c
> +++ b/arch/x86_64/pci/mmconfig.c
> @@ -75,8 +75,10 @@ static int pci_mmcfg_read(unsigned int s
>  	char __iomem *addr;
>  
>  	/* Why do we have this when nobody checks it. How about a BUG()!? -AK */
> -	if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095)))
> +	if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095))) {
> +		*value = -1;

As the code check indicates, value might be NULL.

Please fix.

	Jeff



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

* Re: [PATCH] i386/x86-64: Return defined error value for bad PCI config space accesses
  2006-04-09 19:17 ` [PATCH] i386/x86-64: Return defined error value for bad PCI config space accesses Jeff Garzik
@ 2006-04-09 19:55   ` Andi Kleen
  0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2006-04-09 19:55 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: Andrew Morton, Linux Kernel Mailing List

On Sunday 09 April 2006 21:17, Jeff Garzik wrote:

> As the code check indicates, value might be NULL.
> 
> Please fix.

It should never be NULL.  If anything that's a BUG_ON, but crashing on it is ok
too. 

But I'll change it to a BUG_ON in the next patch thanks.

-Andi

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

end of thread, other threads:[~2006-04-09 19:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200604091900.k39J0uVn013016@hera.kernel.org>
2006-04-09 19:17 ` [PATCH] i386/x86-64: Return defined error value for bad PCI config space accesses Jeff Garzik
2006-04-09 19:55   ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox