From patchwork Thu Nov 19 23:43:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 7662361 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BDE4FBF90C for ; Thu, 19 Nov 2015 23:44:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0928E20465 for ; Thu, 19 Nov 2015 23:44:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3552F201C0 for ; Thu, 19 Nov 2015 23:44:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934928AbbKSXnW (ORCPT ); Thu, 19 Nov 2015 18:43:22 -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 Received: from LT001.fritz.box ([37.24.11.201]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0MX19U-1Zu0RV0DHY-00VyaX; Fri, 20 Nov 2015 00:43:09 +0100 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/EjkgC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kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);