Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
PPC: CHRP - fix possible NULL pointer dereference
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Cyrill Gorcunov  
View profile  
 More options Nov 22 2007, 3:10 pm
Newsgroups: linux.kernel
From: Cyrill Gorcunov <gorcu...@gmail.com>
Date: Thu, 22 Nov 2007 21:10:05 +0100
Local: Thurs, Nov 22 2007 3:10 pm
Subject: [PATCH] PPC: CHRP - fix possible NULL pointer dereference
From: Cyrill Gorcunov <gorcu...@gmail.com>

This patch does fix possible NULL pointer dereference
inside of strncmp() if of_get_property() failed.

Signed-off-by: Cyrill Gorcunov <gorcu...@gmail.com>
---

 arch/powerpc/platforms/chrp/setup.c |   23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 5930626..e3f276d 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -115,7 +115,7 @@ void chrp_show_cpuinfo(struct seq_file *m)
        seq_printf(m, "machine\t\t: CHRP %s\n", model);

        /* longtrail (goldengate) stuff */
-       if (!strncmp(model, "IBM,LongTrail", 13)) {
+       if (model && !strncmp(model, "IBM,LongTrail", 13)) {
                /* VLSI VAS96011/12 `Golden Gate 2' */
                /* Memory banks */
                sdramen = (in_le32(gg2_pci_config_base + GG2_PCI_DRAM_CTRL)
@@ -203,16 +203,19 @@ static void __init sio_fixup_irq(const char *name, u8 device, u8 level,
 static void __init sio_init(void)
 {
        struct device_node *root;
+       const char *model = NULL;

-       if ((root = of_find_node_by_path("/")) &&
-           !strncmp(of_get_property(root, "model", NULL),
-                       "IBM,LongTrail", 13)) {
-               /* logical device 0 (KBC/Keyboard) */
-               sio_fixup_irq("keyboard", 0, 1, 2);
-               /* select logical device 1 (KBC/Mouse) */
-               sio_fixup_irq("mouse", 1, 12, 2);
-       }
-       of_node_put(root);
+       root = of_find_node_by_path("/");
+       if (root) {
+               model = of_get_property(root, "model", NULL);
+               if (model && !strncmp(model,"IBM,LongTrail", 13)) {
+                       /* logical device 0 (KBC/Keyboard) */
+                       sio_fixup_irq("keyboard", 0, 1, 2);
+                       /* select logical device 1 (KBC/Mouse) */
+                       sio_fixup_irq("mouse", 1, 12, 2);
+               }
+               of_node_put(root);
+       }
 }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stephen Rothwell  
View profile  
 More options Nov 22 2007, 6:20 pm
Newsgroups: linux.kernel
From: Stephen Rothwell <s...@canb.auug.org.au>
Date: Fri, 23 Nov 2007 00:20:07 +0100
Local: Thurs, Nov 22 2007 6:20 pm
Subject: Re: [PATCH] PPC: CHRP - fix possible NULL pointer dereference

On Thu, 22 Nov 2007 22:54:23 +0300 Cyrill Gorcunov <gorcu...@gmail.com> wrote:

> This patch does fix possible NULL pointer dereference
> inside of strncmp() if of_get_property() failed.

Thanks for this.

>  static void __init sio_init(void)
>  {
>    struct device_node *root;
> +  const char *model = NULL;

You don't need this initialization as you always assign the variable
before you use it.

> +  root = of_find_node_by_path("/");
> +  if (root) {

        if (!root)
                return;

would save a level of indentation. Not important.

--
Cheers,
Stephen Rothwell                    s...@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

  application_pgp-signature_part
< 1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cyrill Gorcunov  
View profile  
 More options Nov 22 2007, 11:30 pm
Newsgroups: linux.kernel
From: "Cyrill Gorcunov" <gorcu...@gmail.com>
Date: Fri, 23 Nov 2007 05:30:11 +0100
Local: Thurs, Nov 22 2007 11:30 pm
Subject: Re: [PATCH] PPC: CHRP - fix possible NULL pointer dereference
On 11/23/07, Stephen Rothwell <s...@canb.auug.org.au> wrote:

Oh my :) Thanks. I'll fix it and resend.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cyrill Gorcunov  
View profile  
 More options Nov 23 2007, 12:50 am
Newsgroups: linux.kernel
From: "Cyrill Gorcunov" <gorcu...@gmail.com>
Date: Fri, 23 Nov 2007 06:50:08 +0100
Local: Fri, Nov 23 2007 12:50 am
Subject: Re: [PATCH] PPC: CHRP - fix possible NULL pointer dereference

Here is updated version
---
From: Cyrill Gorcunov <gorcu...@gmail.com>

This patch does fix possible NULL pointer dereference
inside of strncmp() if of_get_property() failed.

Signed-off-by: Cyrill Gorcunov <gorcu...@gmail.com>
---

  ppc-chrs-null-fix.diff
1K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »