From patchwork Mon Sep 2 08:14:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 2852714 Return-Path: X-Original-To: patchwork-linux-arm@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 E39DF9F495 for ; Mon, 2 Sep 2013 08:33:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF5432023F for ; Mon, 2 Sep 2013 08:33:44 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B26A720207 for ; Mon, 2 Sep 2013 08:33:43 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VGPZc-00055b-AE; Mon, 02 Sep 2013 08:33:24 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VGPZW-0001Q3-PO; Mon, 02 Sep 2013 08:33:18 +0000 Received: from mail-pd0-f177.google.com ([209.85.192.177]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VGPZP-0001NX-7t for linux-arm-kernel@lists.infradead.org; Mon, 02 Sep 2013 08:33:11 +0000 Received: by mail-pd0-f177.google.com with SMTP id y10so4469257pdj.22 for ; Mon, 02 Sep 2013 01:32:47 -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=brQJKYBwmLNe+DyYSEttmE00hX8wOpEily7D91fS708=; b=db80yEEQAVmbFpui44m9QaYJygml8wzSc6PPyeMf6ph9ZdEPMImUKTU4GoDAzNH3// Ys+lqkz1hhxzD86QJz11HIJYJFQ11CFjxpVn4Vuo7DwVLsUNM5elvkAlTMOUxyairOTU LHypIn0v3hZZYefmNouFvmfEsbJBmNPbITRmbR+ebJx/Jc0WvlmEQap7WnjFFYRm9fzM MTMo9Pym27pBzd0QnngoGnEaTbvksM3r4byO5GbyRyDBZrd7EEer5VapSB0mZlbSvA1a Aw4fm29ZJ0YinF+4fAb/XWrf7Hivy4nMPcHKEC/1LKrfvIEkIrExGRNIt469fSJqRpjW VRJQ== X-Gm-Message-State: ALoCoQl3mewmrblq34fMi3wIPfOKPGMRZETPTByX51wNxdBJaQUTBk2xCtvyCq0DIqfNlW+Zcz5P X-Received: by 10.66.156.229 with SMTP id wh5mr1735153pab.156.1378110766925; Mon, 02 Sep 2013 01:32:46 -0700 (PDT) Received: from linaro.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id bu4sm14418577pbc.11.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Sep 2013 01:32:46 -0700 (PDT) From: Sachin Kamat To: linux-kernel@vger.kernel.org Subject: [PATCH 2/2] dma: ste_dma40: Fix potential null pointer dereference Date: Mon, 2 Sep 2013 13:44:59 +0530 Message-Id: <1378109699-25245-2-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1378109699-25245-1-git-send-email-sachin.kamat@linaro.org> References: <1378109699-25245-1-git-send-email-sachin.kamat@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130902_043311_358840_C0671E7D X-CRM114-Status: UNSURE ( 9.47 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) Cc: vinod.koul@intel.com, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-6.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 kcalloc can return NULL. Check the pointer before dereferencing. Signed-off-by: Sachin Kamat Acked-by: Linus Walleij --- drivers/dma/ste_dma40.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index df0a606..82d2b97 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c @@ -2591,6 +2591,9 @@ dma40_prep_dma_cyclic(struct dma_chan *chan, dma_addr_t dma_addr, int i; sg = kcalloc(periods + 1, sizeof(struct scatterlist), GFP_NOWAIT); + if (!sg) + return NULL; + for (i = 0; i < periods; i++) { sg_dma_address(&sg[i]) = dma_addr; sg_dma_len(&sg[i]) = period_len;