Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934944AbbKSXnX (ORCPT ); Thu, 19 Nov 2015 18:43:23 -0500 Received: from mout.gmx.net ([212.227.17.22]:59297 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934846AbbKSXnT (ORCPT ); Thu, 19 Nov 2015 18:43:19 -0500 From: Heinrich Schuchardt To: Felipe Balbi Cc: Chanwoo Choi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Heinrich Schuchardt Subject: [PATCH 1/1] usb: phy: omap-otg: do not write to unallocated memory Date: Fri, 20 Nov 2015 00:43:01 +0100 Message-Id: <1447976581-12666-1-git-send-email-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.1.4 X-Provags-ID: V03:K0:sBvs9w4XZB1/ItcilH4jrkeU/EjkgCoofAvjO0ctJ64XMb4Y2gX 4i2DKouO38qWQPhGKOD0mg5vMRPd7AeHrUOioAH8RsoAnZuwuYUTGk6/MyhD1mZ26UeCC9Y ARn9hsrIXFZfUnrjHT/Fx0JneKAPVKcj7chqaQxj6GPhJQSdIZHNx6hTnAI+/CeF1Jg0fjn 9niQz1tM0eg4ET1GocjvA== X-UI-Out-Filterresults: notjunk:1;V01:K0:nNnRCoTthrY=:QQTCt0HohPHWn1o1Z1g/38 gjEo2qEaRVOdqEwKl/9OMlDstjc7/LfWF+MZMKIi3zz74Db3Ylxa2ZMPfC+caUEDBvC208b+4 LLz6iMAdPB/vbLL95buZ/IxOX+RC/69cDzqM52Q/5juOJCSnkefIB2ZrZt0AQuYl2aY2k46Dr tokhohhkut3IN6ribN4WTQeOjLegexxtLDDqbytxZKvNpSwgZ2FypjWrkpQdZZ6n98vaGkXRH aMWlrn6oYcyYITeb7V8WHthbN6eW9jhm4vc7lVmZQdu+0mUkqZ5AZJVzYtsMmdBVW4OEOtF5d 3reBokIDxGOyPVQYtZUvUerW4gWNxx33AHF2op/u2CNIy0Xzir89AXLY0sq0NIyDpMLUpKTM7 2kySnv/qdfX/C5Gk7hPYv9S2U0jXtk5f4tY4ejBsYhm1Eb9IImdYLg6IUh82pWQBXIVeFVN7S anWyOi917qvmzKp8GU9ouqt9RhBkZ/8Nk1w1Wf1/nv7gqt1EQDgWFeRia4MOKXU/VVR+hiq2I vA5fhjh3dPwwtqoxKNQZfSGDqnA1tKjXfHhYnrgH4VeTRffABqKzSPheJI4FMY7tm1QexZWB0 OZ0WoyZgdlZV57iAKoQMF3pSQ/jfHFPyKZxBZXnhbO5mPRGsoWLoubQEvUqa/PMHj3sC+5K29 IRLetIfsvwtrbCO6WyPKmJUg7aKGDqpbJ0I4xvHL51QeblAk5xtpd06Uh2ESy8LoRi5gz5e/h 72WKUNtUYJItaJzjltdn3+0GPQZwfTXGSwxaUGUx9z2y+IXgWn3HCACP1/Q= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1114 Lines: 34 The current coding writes to memory before allocating it. Signed-off-by: Heinrich Schuchardt --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/