From patchwork Fri Aug 15 12:40:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Griffin X-Patchwork-Id: 4727081 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C09529F3EE for ; Fri, 15 Aug 2014 12:42:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 03F3F201E4 for ; Fri, 15 Aug 2014 12:42:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 31FA7201ED for ; Fri, 15 Aug 2014 12:42:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751144AbaHOMkb (ORCPT ); Fri, 15 Aug 2014 08:40:31 -0400 Received: from mail-wi0-f174.google.com ([209.85.212.174]:47466 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751122AbaHOMk0 (ORCPT ); Fri, 15 Aug 2014 08:40:26 -0400 Received: by mail-wi0-f174.google.com with SMTP id d1so785337wiv.1 for ; Fri, 15 Aug 2014 05:40:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3f9FJRH0vZoO1cIMNBERL9nzo3ne6l4J4YsjgRzeb2g=; b=N2xk8l7Yrt1ClO+2sL7YTcbHn59RYHSFcMW17rsteGQ27gSv8gTBz+WLt3J1lCsSUL G/sRCAyqk5V0u9CP8sxzKyJTZb/AZSTjlK4ZNShGITThkcibRgaqd/jN1i6YxF3RwySq wimJZy1JdU5IaffKGp5AR3PVNq6eFnLDaDb2ThcQZDoex1RwKsuDUp2EYh0cN0WE1+Bw cO4T/aeEYcT8PX01rtA07pj2HOhPvM/qYHwKVjh0SblV+ezlJnFn0A1CILARRAsWt5zR 1YTjKqgvKVRESAmVhcGgKG7MOj0vHFXADL1jELRLZpvDl1aVZ03dl5zai6H8+b3kmVAj NWpg== X-Gm-Message-State: ALoCoQl6GPQRSyYDIcfX2uz9Wc27s/RpDbzia2SdloOzF4SPqSu3QYOB1Xsd9AGoNv92avd9QORa X-Received: by 10.180.221.133 with SMTP id qe5mr49775796wic.17.1408106425018; Fri, 15 Aug 2014 05:40:25 -0700 (PDT) Received: from localhost.localdomain (cpc14-aztw22-2-0-cust189.18-1.cable.virginm.net. [82.45.1.190]) by mx.google.com with ESMTPSA id fr2sm6486559wib.7.2014.08.15.05.40.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Aug 2014 05:40:24 -0700 (PDT) From: Peter Griffin To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kishon@ti.com, kgene.kim@samsung.com, maxime.ripard@free-electrons.com, linux-samsung-soc@vger.kernel.org Cc: peter.griffin@linaro.org, patches@linaro.org, lee.jones@linaro.org Subject: [PATCH 2/9] phy: phy-mvebu-sata: Add missing error check for devm_kzalloc Date: Fri, 15 Aug 2014 13:40:09 +0100 Message-Id: <1408106416-19044-3-git-send-email-peter.griffin@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408106416-19044-1-git-send-email-peter.griffin@linaro.org> References: <1408106416-19044-1-git-send-email-peter.griffin@linaro.org> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, 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 Currently this driver is missing a check on the return value of devm_kzalloc, which would cause a NULL pointer dereference in a OOM situation. This patch adds the aformentioned missing check. Signed-off-by: Peter Griffin Acked-by: Andrew Lunn --- drivers/phy/phy-mvebu-sata.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/phy/phy-mvebu-sata.c b/drivers/phy/phy-mvebu-sata.c index cc3c0e1..10bb8e5 100644 --- a/drivers/phy/phy-mvebu-sata.c +++ b/drivers/phy/phy-mvebu-sata.c @@ -89,6 +89,8 @@ static int phy_mvebu_sata_probe(struct platform_device *pdev) struct phy *phy; priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); priv->base = devm_ioremap_resource(&pdev->dev, res);