From patchwork Wed Nov 21 09:06:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13032 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 75D9423FC9 for ; Wed, 21 Nov 2012 09:19:34 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1A4B4A19643 for ; Wed, 21 Nov 2012 09:19:34 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so2347871iag.11 for ; Wed, 21 Nov 2012 01:19:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=5fMSPTt5vIWAtAx5KHew/YVyqUQfwD6y+hwSuh2CYhU=; b=LiAiwwgdDiCn/1vX9nmyGjy2urWwhJgWjrw3q+1yjjcNxenb81BMKbULxxNcKWZ2uO DSgq01HoXMh32Wln0WTOWTTjHHhA3CDNSvrR9TYTH/Zvu5+G7oYhfaKn1uaKO4DZn5HS 7NEzoUnkw8e8w42Rje/brZn/hDY5sP3zbcLoxK3Y5bQR/CkI+O4dygS98POBuiDIgFGN 6tfr2tv9A/Stlmh5objImpg3rWRreXSmdrzSoubUzWFw9fyX5z0dMhGYPuHe0Xmo4AYC PBVua1hZP/612Ri+t1XyEDtImYxN6RQCBauEfmEuR7hmYAZFsErsDMjh7v3POy/PBX8Q R2sg== Received: by 10.43.7.132 with SMTP id oo4mr16596947icb.6.1353489573564; Wed, 21 Nov 2012 01:19:33 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp465igt; Wed, 21 Nov 2012 01:19:33 -0800 (PST) Received: by 10.66.76.98 with SMTP id j2mr15908766paw.65.1353489229038; Wed, 21 Nov 2012 01:13:49 -0800 (PST) Received: from mail-pb0-f46.google.com (mail-pb0-f46.google.com [209.85.160.46]) by mx.google.com with ESMTPS id sh10si21833964pbb.323.2012.11.21.01.13.30 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Nov 2012 01:13:49 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.46 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.46; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.46 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pb0-f46.google.com with SMTP id wy7so4990145pbc.5 for ; Wed, 21 Nov 2012 01:13:30 -0800 (PST) Received: by 10.66.74.65 with SMTP id r1mr15927825pav.75.1353489210451; Wed, 21 Nov 2012 01:13:30 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id mn5sm9621802pbc.12.2012.11.21.01.13.27 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Nov 2012 01:13:29 -0800 (PST) From: Sachin Kamat To: alsa-devel@alsa-project.org Cc: perex@perex.cz, tiwai@suse.de, broonie@opensource.wolfsonmicro.com, lrg@ti.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 6/6] ASoC: dapm: Fix potential NULL pointer dereference Date: Wed, 21 Nov 2012 14:36:59 +0530 Message-Id: <1353488819-13902-6-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353488819-13902-1-git-send-email-sachin.kamat@linaro.org> References: <1353488819-13902-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQka1S7uUVCvDmPcwHz39FUlCqCsZDNySbAumudLfwY88bjZm/BBehaifchM77Zjm1vCsF6E 'w' should not be dereferenced when it is NULL. Cc: Liam Girdwood Cc: Mark Brown Signed-off-by: Sachin Kamat --- Build tested and based on linux-next 20121115. --- sound/soc/soc-dapm.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 6e35bca..5bde5d4 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -3326,9 +3326,9 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, if (!w) { dev_err(dapm->dev, "Failed to create %s widget\n", dai->driver->playback.stream_name); + } else { + w->priv = dai; } - - w->priv = dai; dai->playback_widget = w; } @@ -3344,9 +3344,9 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm, if (!w) { dev_err(dapm->dev, "Failed to create %s widget\n", dai->driver->capture.stream_name); + } else { + w->priv = dai; } - - w->priv = dai; dai->capture_widget = w; }