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: 35453 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1849420523 for ; Fri, 15 Aug 2014 12:40:27 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f73sf7399912yha.3 for ; Fri, 15 Aug 2014 05:40:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=3f9FJRH0vZoO1cIMNBERL9nzo3ne6l4J4YsjgRzeb2g=; b=H0JvkNw6RRQAw+e72NQL2RWsFve/NeEeeqYhpleZ9nkrTGyKy1dVfRSVmxdVYckR3h o98ySQO+Um84XsLUwKD4wETc0mziLZ/RXYZCxmxPnInp2kadJfZW5dXvnTLveeoYXGX6 JSOCkBENKf23O9cjfuDPlmQ9JhA4RwjrWciJ4HUBKPVUgjsu628XOhIeQiPtJfb0gaYs lJuGi2cpr5BYtkrwo5BUcRgg8imnyrWsrvkRm9NQB4q2G/nYwoTJVUj1AyVFcWAD7rcC dG+wtU+ANNfy8yMHHMYKm7KExl+Smb99eh7OTSM6GkHrEfkktFGMTOW7Cm1WVuQ/4EIz axlQ== X-Gm-Message-State: ALoCoQlDH5Xw+SiC2Op3XswHHMPfNtb3tegQY7uf8fD4sHxJCl5L5vIPX0zp7gzQ9XqLMAbx3UBm X-Received: by 10.52.170.204 with SMTP id ao12mr1426873vdc.2.1408106426817; Fri, 15 Aug 2014 05:40:26 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.86.176 with SMTP id p45ls1374605qgd.57.gmail; Fri, 15 Aug 2014 05:40:26 -0700 (PDT) X-Received: by 10.140.108.68 with SMTP id i62mr25865772qgf.56.1408106426741; Fri, 15 Aug 2014 05:40:26 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id e46si11666244qgd.12.2014.08.15.05.40.26 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Aug 2014 05:40:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hy4so2812064vcb.22 for ; Fri, 15 Aug 2014 05:40:26 -0700 (PDT) X-Received: by 10.52.147.15 with SMTP id tg15mr874377vdb.53.1408106426533; Fri, 15 Aug 2014 05:40:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp109561vcb; Fri, 15 Aug 2014 05:40:26 -0700 (PDT) X-Received: by 10.180.85.136 with SMTP id h8mr3753081wiz.67.1408106425550; Fri, 15 Aug 2014 05:40:25 -0700 (PDT) Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by mx.google.com with ESMTPS id x6si11338778wjq.40.2014.08.15.05.40.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 15 Aug 2014 05:40:25 -0700 (PDT) Received-SPF: pass (google.com: domain of peter.griffin@linaro.org designates 209.85.212.175 as permitted sender) client-ip=209.85.212.175; Received: by mail-wi0-f175.google.com with SMTP id ho1so779414wib.8 for ; Fri, 15 Aug 2014 05:40:25 -0700 (PDT) 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> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.griffin@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);