From patchwork Mon Nov 23 12:15:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 7680791 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D39579F1BE for ; Mon, 23 Nov 2015 12:15:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 17CFA205D1 for ; Mon, 23 Nov 2015 12:15:47 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id DEF7820384 for ; Mon, 23 Nov 2015 12:15:45 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 92BF4265460; Mon, 23 Nov 2015 13:15:39 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D38352650DB; Mon, 23 Nov 2015 13:15:32 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 89BDC2652D7; Mon, 23 Nov 2015 13:15:30 +0100 (CET) Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by alsa0.perex.cz (Postfix) with ESMTP id 619C6261171 for ; Mon, 23 Nov 2015 13:15:23 +0100 (CET) Received: by pacdm15 with SMTP id dm15so189748674pac.3 for ; Mon, 23 Nov 2015 04:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=IR/X8DHjmY06qvDc/mdN5t15BYqpWuFVu6JYcpBB5Ho=; b=nJNjAJUBsLXQK9AMA8+3cmXN2cizhZxRi5QZZR8CkZGgz7S0ZFc6lzmW3mmW6Xu3mw d6oR+C8Le6kxL7UcC85aTR5vwEcuV8tKSsWNCfuFGzX4IQcSSKtAg9vnPd5XIweO+sw8 PVL1Aju+O+YABwnI/qaX+ehgwiCe/4Bz14qjwc3JaB58+TEUWFF/qGuo7LKH8GMjW4pN ZTwvdWXkdJUEA+juKDBg5LQhatPl6QGqGoESZ3GhMgqIRuo5fNBd6QldymxgeHHAVAWy 9sJcp09j2crsjCe9MntoL+A5Az4VKhYmVJdAQRXRRShSSCKdfFp4UgkmvP9KkU4ddr+x v0kg== X-Received: by 10.66.90.194 with SMTP id by2mr35498271pab.2.1448280921984; Mon, 23 Nov 2015 04:15:21 -0800 (PST) Received: from sudip-pc.vectortproxy.org ([122.169.181.80]) by smtp.gmail.com with ESMTPSA id hg2sm10300483pbb.7.2015.11.23.04.15.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Nov 2015 04:15:20 -0800 (PST) From: Sudip Mukherjee To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Date: Mon, 23 Nov 2015 17:45:13 +0530 Message-Id: <1448280913-16061-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Sudip Mukherjee Subject: [alsa-devel] [PATCH] ASoC: hdac_hdmi: fix possible NULL dereference X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP kzalloc() can return NULL if it fails, and then we will be dereferencing a NULL pointer. Signed-off-by: Sudip Mukherjee --- sound/soc/codecs/hdac_hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index d155262..205f2c2 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -200,6 +200,8 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream, } dd = kzalloc(sizeof(*dd), GFP_KERNEL); + if (!dd) + return -ENOMEM; dd->format = snd_hdac_calc_stream_format(params_rate(hparams), params_channels(hparams), params_format(hparams), 24, 0);