From patchwork Wed Sep 24 13:47:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 37835 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5554B204FF for ; Wed, 24 Sep 2014 13:56:35 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id x13sf1458525wgg.0 for ; Wed, 24 Sep 2014 06:56:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=YEVl/CydaUu3/ppBETBZm6rd4br1DO0fvR9r9fNGES8=; b=O6xC93v+iSAtepPpHKXEtip/hA+OWKKu6+eBUIdyyECIgVij/ok48SjfDXLHZrr/VR YLsOLCegcAblZvhlEB1oFLJL6i7eI/4wDFXMcze6Ms4B1UImM1VCF2AdI7tILL5p8ACK Y2TqehtuaaVqUAbScpZ6zCXn5+F5qhKgbaPGx7EYayqHyYFjLCi7IXEgqL2q+3/w71n2 rLtAtoCh8LAt5H7ahbqezTe9AQ8bSAkMxMKVUdlRhxSw5MzMLfHoIkF9NSMpS1LcC6bf mCayqYt4j5feJw1jmWFLtYyNjioFBPZhMdGiFFr8/gbj2oi8ay57RxjxXHjB4rotngT6 BPuw== X-Gm-Message-State: ALoCoQkiSH95hHmUEzDITpbXQyj+L1tISLrZzmUQxr9FwvDXWxQ3GQpcQpgfNqqEXGVFONs/S0lq X-Received: by 10.112.163.104 with SMTP id yh8mr1028183lbb.5.1411566994474; Wed, 24 Sep 2014 06:56:34 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.3 with SMTP id o3ls154605lah.14.gmail; Wed, 24 Sep 2014 06:56:34 -0700 (PDT) X-Received: by 10.112.54.135 with SMTP id j7mr6127780lbp.51.1411566994303; Wed, 24 Sep 2014 06:56:34 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com [209.85.215.50]) by mx.google.com with ESMTPS id jf4si22906544lbc.100.2014.09.24.06.56.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 06:56:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id ty20so10616466lab.37 for ; Wed, 24 Sep 2014 06:56:34 -0700 (PDT) X-Received: by 10.112.163.103 with SMTP id yh7mr6212451lbb.73.1411566994152; Wed, 24 Sep 2014 06:56:34 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.130.169 with SMTP id of9csp586242lbb; Wed, 24 Sep 2014 06:56:31 -0700 (PDT) X-Received: by 10.70.55.42 with SMTP id o10mr7736166pdp.100.1411566991105; Wed, 24 Sep 2014 06:56:31 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3si23123880pdl.114.2014.09.24.06.56.30 for ; Wed, 24 Sep 2014 06:56:31 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754299AbaIXN42 (ORCPT + 27 others); Wed, 24 Sep 2014 09:56:28 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:50976 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753063AbaIXNr2 (ORCPT ); Wed, 24 Sep 2014 09:47:28 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s8ODlRml031866; Wed, 24 Sep 2014 08:47:27 -0500 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8ODlRWq009370; Wed, 24 Sep 2014 08:47:27 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Wed, 24 Sep 2014 08:47:26 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s8ODlKDM015622; Wed, 24 Sep 2014 08:47:26 -0500 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 03/22] phy: phy-mvebu-sata: Add missing error check for devm_kzalloc Date: Wed, 24 Sep 2014 19:17:01 +0530 Message-ID: <1411566440-19169-4-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1411566440-19169-1-git-send-email-kishon@ti.com> References: <1411566440-19169-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: kishon@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Peter Griffin 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 Signed-off-by: Kishon Vijay Abraham I --- 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);