public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PPC: Fix potential NULL dereference
@ 2007-11-15 18:47 Cyrill Gorcunov
  2007-11-20  5:51 ` Kumar Gala
  0 siblings, 1 reply; 2+ messages in thread
From: Cyrill Gorcunov @ 2007-11-15 18:47 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: LKML

This patch does fix potential NULL pointer dereference
that could take place inside of strcmp() if
of_get_property() call failed.

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

 arch/powerpc/platforms/83xx/usb.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index eafe760..b45160f 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -130,7 +130,7 @@ int mpc831x_usb_cfg(void)
 	out_be32(immap + MPC83XX_SCCR_OFFS, temp);
 
 	/* Configure pin mux for ULPI.  There is no pin mux for UTMI */
-	if (!strcmp(prop, "ulpi")) {
+	if (prop && !strcmp(prop, "ulpi")) {
 		temp = in_be32(immap + MPC83XX_SICRL_OFFS);
 		temp &= ~MPC831X_SICRL_USB_MASK;
 		temp |= MPC831X_SICRL_USB_ULPI;
@@ -153,13 +153,13 @@ int mpc831x_usb_cfg(void)
 	usb_regs = ioremap(res.start, res.end - res.start + 1);
 
 	/* Using on-chip PHY */
-	if (!strcmp(prop, "utmi_wide") ||
-			!strcmp(prop, "utmi")) {
+	if (prop && (!strcmp(prop, "utmi_wide") ||
+		     !strcmp(prop, "utmi"))) {
 		/* Set UTMI_PHY_EN, REFSEL to 48MHZ */
 		out_be32(usb_regs + FSL_USB2_CONTROL_OFFS,
 				CONTROL_UTMI_PHY_EN | CONTROL_REFSEL_48MHZ);
 	/* Using external UPLI PHY */
-	} else if (!strcmp(prop, "ulpi")) {
+	} else if (prop && !strcmp(prop, "ulpi")) {
 		/* Set PHY_CLK_SEL to ULPI */
 		temp = CONTROL_PHY_CLK_SEL_ULPI;
 #ifdef CONFIG_USB_OTG

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

* Re: [PATCH] PPC: Fix potential NULL dereference
  2007-11-15 18:47 [PATCH] PPC: Fix potential NULL dereference Cyrill Gorcunov
@ 2007-11-20  5:51 ` Kumar Gala
  0 siblings, 0 replies; 2+ messages in thread
From: Kumar Gala @ 2007-11-20  5:51 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: Paul Mackerras, LKML, linuxppc-dev

On Thu, 15 Nov 2007, Cyrill Gorcunov wrote:

> This patch does fix potential NULL pointer dereference
> that could take place inside of strcmp() if
> of_get_property() call failed.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
>
>  arch/powerpc/platforms/83xx/usb.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
>

CC the linuxppc-dev@ozlabs.org list in the future.

applied.

- k

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

end of thread, other threads:[~2007-11-20  5:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-15 18:47 [PATCH] PPC: Fix potential NULL dereference Cyrill Gorcunov
2007-11-20  5:51 ` Kumar Gala

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