linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] usb: phy: omap-otg: do not write to unallocated memory
@ 2015-11-19 23:43 Heinrich Schuchardt
  2015-11-20  6:02 ` Chanwoo Choi
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2015-11-19 23:43 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Chanwoo Choi, Greg Kroah-Hartman, linux-usb, linux-omap,
	linux-kernel, Heinrich Schuchardt

The current coding writes to memory before allocating it.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 drivers/usb/phy/phy-omap-otg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
index 1270906..8bbf121 100644
--- a/drivers/usb/phy/phy-omap-otg.c
+++ b/drivers/usb/phy/phy-omap-otg.c
@@ -105,12 +105,13 @@ static int omap_otg_probe(struct platform_device *pdev)
 	extcon = extcon_get_extcon_dev(config->extcon);
 	if (!extcon)
 		return -EPROBE_DEFER;
-	otg_dev->extcon = extcon;
 
 	otg_dev = devm_kzalloc(&pdev->dev, sizeof(*otg_dev), GFP_KERNEL);
 	if (!otg_dev)
 		return -ENOMEM;
 
+	otg_dev->extcon = extcon;
+
 	otg_dev->base = devm_ioremap_resource(&pdev->dev, &pdev->resource[0]);
 	if (IS_ERR(otg_dev->base))
 		return PTR_ERR(otg_dev->base);
-- 
2.1.4


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

* Re: [PATCH 1/1] usb: phy: omap-otg: do not write to unallocated memory
  2015-11-19 23:43 [PATCH 1/1] usb: phy: omap-otg: do not write to unallocated memory Heinrich Schuchardt
@ 2015-11-20  6:02 ` Chanwoo Choi
  0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2015-11-20  6:02 UTC (permalink / raw)
  To: Heinrich Schuchardt, Felipe Balbi
  Cc: Greg Kroah-Hartman, linux-usb, linux-omap, linux-kernel

Hi,

The same patch was already reviewed and applied on usb.git repository[1]
[1] https://git.kernel.org/cgit/linux/kernel/git/balbi/usb.git/commit/?h=testing/fixes&id=2c2025b41aeff57963f9ae2dd909fea704c625ab

Thanks,
Chanwoo Choi

On 2015년 11월 20일 08:43, Heinrich Schuchardt wrote:
> The current coding writes to memory before allocating it.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>  drivers/usb/phy/phy-omap-otg.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/phy/phy-omap-otg.c b/drivers/usb/phy/phy-omap-otg.c
> index 1270906..8bbf121 100644
> --- a/drivers/usb/phy/phy-omap-otg.c
> +++ b/drivers/usb/phy/phy-omap-otg.c
> @@ -105,12 +105,13 @@ static int omap_otg_probe(struct platform_device *pdev)
>  	extcon = extcon_get_extcon_dev(config->extcon);
>  	if (!extcon)
>  		return -EPROBE_DEFER;
> -	otg_dev->extcon = extcon;
>  
>  	otg_dev = devm_kzalloc(&pdev->dev, sizeof(*otg_dev), GFP_KERNEL);
>  	if (!otg_dev)
>  		return -ENOMEM;
>  
> +	otg_dev->extcon = extcon;
> +
>  	otg_dev->base = devm_ioremap_resource(&pdev->dev, &pdev->resource[0]);
>  	if (IS_ERR(otg_dev->base))
>  		return PTR_ERR(otg_dev->base);
> 


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

end of thread, other threads:[~2015-11-20  6:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-19 23:43 [PATCH 1/1] usb: phy: omap-otg: do not write to unallocated memory Heinrich Schuchardt
2015-11-20  6:02 ` Chanwoo Choi

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).