From: "Cyrill Gorcunov" <gorcunov@gmail.com>
To: "Ishizaki Kou" <kou.ishizaki@toshiba.co.jp>
Cc: olof@lixom.net, paulus@samba.org, linux-kernel@vger.kernel.org,
linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] PPC: CELLEB - fix potential NULL pointer dereference
Date: Thu, 29 Nov 2007 08:41:14 +0300 [thread overview]
Message-ID: <aa79d98a0711282141l6b07569fmb925b198730a554e@mail.gmail.com> (raw)
In-Reply-To: <20071129.122245.-1300543769.kouish@swc.toshiba.co.jp>
[-- Attachment #1: Type: text/plain, Size: 369 bytes --]
On 11/29/07, Ishizaki Kou <kou.ishizaki@toshiba.co.jp> wrote:
[...snip...]
>
> There is no problem to use Michael's part, and I also prefer simple
> one like this.
>
> Cyrill, would you please update your patch?
>
> Best regards,
> Kou Ishizaki
>
Please see updated patch enveloped. (Can't do it inline becase I'm on
my work now where I have no Linux machine)
Cyrill
[-- Attachment #2: ppc-celleb-fix-null-v2.diff --]
[-- Type: text/plain, Size: 1977 bytes --]
---
From: Cyrill Gorcunov <gorcunov@gmail.com>
Subject: [PATCH] PPC: CELLEB - fix possible NULL pointer dereference
This patch adds checking for NULL returned value to
prevent possible NULL pointer dereference.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/powerpc/platforms/celleb/pci.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/celleb/pci.c b/arch/powerpc/platforms/celleb/pci.c
index 6bc32fd..13ec4a6 100644
--- a/arch/powerpc/platforms/celleb/pci.c
+++ b/arch/powerpc/platforms/celleb/pci.c
@@ -138,8 +138,6 @@ static void celleb_config_read_fake(unsigned char *config, int where,
*val = celleb_fake_config_readl(p);
break;
}
-
- return;
}
static void celleb_config_write_fake(unsigned char *config, int where,
@@ -158,7 +156,6 @@ static void celleb_config_write_fake(unsigned char *config, int where,
celleb_fake_config_writel(val, p);
break;
}
- return;
}
static int celleb_fake_pci_read_config(struct pci_bus *bus,
@@ -351,6 +348,10 @@ static int __init celleb_setup_fake_pci_device(struct device_node *node,
wi1 = of_get_property(node, "vendor-id", NULL);
wi2 = of_get_property(node, "class-code", NULL);
wi3 = of_get_property(node, "revision-id", NULL);
+ if (!wi0 || !wi1 || !wi2 || !wi3) {
+ printk(KERN_ERR "PCI: Missing device tree properties.\n");
+ goto error;
+ }
celleb_config_write_fake(*config, PCI_DEVICE_ID, 2, wi0[0] & 0xffff);
celleb_config_write_fake(*config, PCI_VENDOR_ID, 2, wi1[0] & 0xffff);
@@ -372,6 +373,10 @@ static int __init celleb_setup_fake_pci_device(struct device_node *node,
celleb_setup_pci_base_addrs(hose, devno, fn, num_base_addr);
li = of_get_property(node, "interrupts", &rlen);
+ if (!li) {
+ printk(KERN_ERR "PCI: interrupts not found.\n");
+ goto error;
+ }
val = li[0];
celleb_config_write_fake(*config, PCI_INTERRUPT_PIN, 1, 1);
celleb_config_write_fake(*config, PCI_INTERRUPT_LINE, 1, val);
next prev parent reply other threads:[~2007-11-29 5:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-26 7:46 [PATCH] PPC: CELLEB - fix potential NULL pointer dereference Cyrill Gorcunov
2007-11-28 8:52 ` Ishizaki Kou
2007-11-28 9:48 ` Michael Ellerman
2007-11-28 10:53 ` Cyrill Gorcunov
2007-11-28 10:59 ` Cyrill Gorcunov
2007-11-29 3:22 ` Ishizaki Kou
2007-11-29 5:41 ` Cyrill Gorcunov [this message]
2007-11-29 7:44 ` [PATCH] PPC: CELLEB - fix possible " Ishizaki Kou
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=aa79d98a0711282141l6b07569fmb925b198730a554e@mail.gmail.com \
--to=gorcunov@gmail.com \
--cc=kou.ishizaki@toshiba.co.jp \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=olof@lixom.net \
--cc=paulus@samba.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 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).