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: 4727181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B7D3DC0338 for ; Fri, 15 Aug 2014 12:45:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EEC1A201ED for ; Fri, 15 Aug 2014 12:45:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 25C38201BC for ; Fri, 15 Aug 2014 12:45:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XIGoP-00080c-0n; Fri, 15 Aug 2014 12:40:53 +0000 Received: from mail-wg0-f41.google.com ([74.125.82.41]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XIGoJ-0007lf-0R for linux-arm-kernel@lists.infradead.org; Fri, 15 Aug 2014 12:40:47 +0000 Received: by mail-wg0-f41.google.com with SMTP id z12so2224405wgg.0 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=cf69xCrnFFwQx1FT/V1u3FmcDY7BJGIGFtKBQBybP28Md1c4wzV0sDltyF+Gz2a59h tFeIJczr9WxTwkm2FP9jvz0jKjf/BMaoz7mvb1GsDLYDOc/3w71NnuHMhGIW+rn3an38 nnt38l8Nx1AW+6TgY9IliOYqcwS5r5XDdzqn3aFAW+8Edn7HuO3C7y+oyTvxPn/a7S5x PVEfB+2fS4jhc+wm81+1RR6QklqyE3JauCdSGgaqXWgK0Cp4QOFlDAy/78dIgTBzhIDv IZsMX0RKH3REfe3CEqkrneUnfUu2Ylz187u328SzKJ50FN+TaFuDM95s88oM2uiF/2V1 Y25Q== X-Gm-Message-State: ALoCoQlUzh9iqbS8eGExES9xGJytMlOjbR3rEbykzfTVcxnr6dj5WU2MYp6rsKJLAQ/h0ZbTWGLg 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 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140815_054047_245530_49A7BC60 X-CRM114-Status: GOOD ( 11.34 ) X-Spam-Score: -0.7 (/) Cc: peter.griffin@linaro.org, lee.jones@linaro.org, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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);