linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Scott Wood <scottwood@freescale.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] mpc832x_rdb.c: prevent using uninitialized variable
Date: Fri, 27 Jul 2007 14:23:49 +0400	[thread overview]
Message-ID: <20070727102349.GA10419@localhost.localdomain> (raw)
In-Reply-To: <20070726164833.GC28491@ld0162-tx32.am.freescale.net>

On Thu, Jul 26, 2007 at 11:48:33AM -0500, Scott Wood wrote:
> On Thu, Jul 26, 2007 at 06:01:39PM +0400, Anton Vorontsov wrote:
> > If CONFIG_PCI undefined, np will be used uninitialized, thereby
> > find_node_by_name(np, "par_io") will fail.
> 
> This is the wrong fix -- you should be passing NULL to the par_io call
> rather than np.  Otherwise, if the par_io is earlier in the tree than the
> pci, you won't find it.

Oops. Right you are, thanks!

I hope this is proper fix.

- - - -
From: Anton Vorontsov <avorontsov@ru.mvista.com>
Subject: [POWERPC] mpc832x_rdb.c: prevent using uninitialized variable

If CONFIG_PCI undefined, np will be used uninitialized, thereby
find_node_by_name(np, "par_io") will fail.

of_find_node_by_name(np, "par_io") isn't used inside loop,
thus we can safely pass NULL instead of np.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 arch/powerpc/platforms/83xx/mpc832x_rdb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index b2b28a4..93ba957 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -56,7 +56,7 @@ static void __init mpc832x_rdb_setup_arch(void)
 #ifdef CONFIG_QUICC_ENGINE
 	qe_reset();
 
-	if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
+	if ((np = of_find_node_by_name(NULL, "par_io")) != NULL) {
 		par_io_init(np);
 		of_node_put(np);
 
-- 
1.5.0.6

      reply	other threads:[~2007-07-27 10:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26 14:01 [PATCH] mpc832x_rdb.c: prevent using uninitialized variable Anton Vorontsov
2007-07-26 16:48 ` Scott Wood
2007-07-27 10:23   ` Anton Vorontsov [this message]

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=20070727102349.GA10419@localhost.localdomain \
    --to=avorontsov@ru.mvista.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=scottwood@freescale.com \
    /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).