SUPERH platform development
 help / color / mirror / Atom feed
* usb: ehci-sh: fix illegal phy_init() running when platform_data is NULL
@ 2012-06-11  8:40 Shimoda, Yoshihiro
  2012-06-11 13:53 ` Alan Stern
  2012-06-12  0:23 ` Shimoda, Yoshihiro
  0 siblings, 2 replies; 3+ messages in thread
From: Shimoda, Yoshihiro @ 2012-06-11  8:40 UTC (permalink / raw)
  To: linux-sh

If the platform_data is not set, pdata will be uninitialized value.
Then, the phy_init() may run on illegal address.

This patch also fixes the following warning:

  CC      drivers/usb/host/ehci-hcd.o
drivers/usb/host/ehci-sh.c: In function ‘ehci_hcd_sh_probe’:
drivers/usb/host/ehci-sh.c:104: warning: ‘pdata’ may be used uninitialized in this function

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/host/ehci-sh.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c
index ca819cd..e7cb392 100644
--- a/drivers/usb/host/ehci-sh.c
+++ b/drivers/usb/host/ehci-sh.c
@@ -126,8 +126,7 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
 		goto fail_create_hcd;
 	}

-	if (pdev->dev.platform_data != NULL)
-		pdata = pdev->dev.platform_data;
+	pdata = pdev->dev.platform_data;

 	/* initialize hcd */
 	hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev,
-- 
1.7.1


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

* Re: usb: ehci-sh: fix illegal phy_init() running when platform_data is NULL
  2012-06-11  8:40 usb: ehci-sh: fix illegal phy_init() running when platform_data is NULL Shimoda, Yoshihiro
@ 2012-06-11 13:53 ` Alan Stern
  2012-06-12  0:23 ` Shimoda, Yoshihiro
  1 sibling, 0 replies; 3+ messages in thread
From: Alan Stern @ 2012-06-11 13:53 UTC (permalink / raw)
  To: linux-sh

On Mon, 11 Jun 2012, Shimoda, Yoshihiro wrote:

> If the platform_data is not set, pdata will be uninitialized value.
> Then, the phy_init() may run on illegal address.

I don't see how this patch fixes that problem.

> This patch also fixes the following warning:
> 
>   CC      drivers/usb/host/ehci-hcd.o
> drivers/usb/host/ehci-sh.c: In function ‘ehci_hcd_sh_probe’:
> drivers/usb/host/ehci-sh.c:104: warning: ‘pdata’ may be used uninitialized in this function

That alone is a good enough reason to accept the patch.  You might want
to update the patch description, though.

> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  drivers/usb/host/ehci-sh.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c
> index ca819cd..e7cb392 100644
> --- a/drivers/usb/host/ehci-sh.c
> +++ b/drivers/usb/host/ehci-sh.c
> @@ -126,8 +126,7 @@ static int ehci_hcd_sh_probe(struct platform_device *pdev)
>  		goto fail_create_hcd;
>  	}
> 
> -	if (pdev->dev.platform_data != NULL)
> -		pdata = pdev->dev.platform_data;
> +	pdata = pdev->dev.platform_data;
> 
>  	/* initialize hcd */
>  	hcd = usb_create_hcd(&ehci_sh_hc_driver, &pdev->dev,

Acked-by: Alan Stern <stern@rowland.harvard.edu>


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

* Re: usb: ehci-sh: fix illegal phy_init() running when platform_data is NULL
  2012-06-11  8:40 usb: ehci-sh: fix illegal phy_init() running when platform_data is NULL Shimoda, Yoshihiro
  2012-06-11 13:53 ` Alan Stern
@ 2012-06-12  0:23 ` Shimoda, Yoshihiro
  1 sibling, 0 replies; 3+ messages in thread
From: Shimoda, Yoshihiro @ 2012-06-12  0:23 UTC (permalink / raw)
  To: linux-sh

2012/06/11 22:53, Alan Stern wrote:
> On Mon, 11 Jun 2012, Shimoda, Yoshihiro wrote:
> 
>> If the platform_data is not set, pdata will be uninitialized value.
>> Then, the phy_init() may run on illegal address.
> 
> I don't see how this patch fixes that problem.

The driver has the following code:

	if (pdata && pdata->phy_init)
		pdata->phy_init();

So, if the condition is true when the pdata is uninitialize value,
the driver may jump the illegal pdata->phy_init().

I will modify this patch to add this patch description.

>> This patch also fixes the following warning:
>>
>>   CC      drivers/usb/host/ehci-hcd.o
>> drivers/usb/host/ehci-sh.c: In function ‘ehci_hcd_sh_probe’:
>> drivers/usb/host/ehci-sh.c:104: warning: ‘pdata’ may be used uninitialized in this function
> 
> That alone is a good enough reason to accept the patch.  You might want
> to update the patch description, though.
> 
< snip >
> 
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> 

Thank you for the Acked-by:

Best regards,
Yoshihiro Shimoda

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

end of thread, other threads:[~2012-06-12  0:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-11  8:40 usb: ehci-sh: fix illegal phy_init() running when platform_data is NULL Shimoda, Yoshihiro
2012-06-11 13:53 ` Alan Stern
2012-06-12  0:23 ` Shimoda, Yoshihiro

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