From: Jeff Garzik <jeff@garzik.org>
To: Andi Kleen <ak@suse.de>, Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] i386/x86-64: Return defined error value for bad PCI config space accesses
Date: Sun, 09 Apr 2006 15:17:38 -0400 [thread overview]
Message-ID: <44395DD2.8080700@garzik.org> (raw)
In-Reply-To: <200604091900.k39J0uVn013016@hera.kernel.org>
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
next parent reply other threads:[~2006-04-09 19:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200604091900.k39J0uVn013016@hera.kernel.org>
2006-04-09 19:17 ` Jeff Garzik [this message]
2006-04-09 19:55 ` [PATCH] i386/x86-64: Return defined error value for bad PCI config space accesses Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44395DD2.8080700@garzik.org \
--to=jeff@garzik.org \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.