From patchwork Wed Nov 21 09:06:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13034 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 14FC023FC9 for ; Wed, 21 Nov 2012 09:20:26 +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 AD342A193B5 for ; Wed, 21 Nov 2012 09:20:25 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id t4so2347871iag.11 for ; Wed, 21 Nov 2012 01:20:25 -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=T/F3/WBG1Em/WzTLP2+dw4f8i0Gg1RF29EP/yuYt9tw=; b=lktCG594+hJi57w0GXyJz7lzbJZo/RPhmBTSvMzRgALjqoWgx6FaMQ1Un+KOkh1Ta7 IIu3bfZJly8PwV1AqE+/EdL7sInMSX+GbTQ54oT6oFh7Ba6bRcOz8lO+1pergjcdnXS8 wV0GA1WSY+b8ZLlIpEK8xGsGRHU1sn9Sci9f6WN2wRFLIsC/0IjkmXUi4f2TTGuxPwX8 eR16J8xpKcqK4sdMg4OuL95XDcD8qt/ss/Y3eShyXgtkDlFeali41x3+JJ05FTo+OXNL 12vCaHOFpev6hl1PFBuYcILEc2amguj30blubezgVhN15uhYJmy6sinauXlrokxEMVdE wDXg== Received: by 10.50.173.34 with SMTP id bh2mr12839789igc.70.1353489625435; Wed, 21 Nov 2012 01:20:25 -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 n20csp582igt; Wed, 21 Nov 2012 01:20:25 -0800 (PST) Received: by 10.68.137.131 with SMTP id qi3mr47050347pbb.114.1353489229037; Wed, 21 Nov 2012 01:13:49 -0800 (PST) Received: from mail-pb0-f48.google.com (mail-pb0-f48.google.com [209.85.160.48]) by mx.google.com with ESMTPS id e3si21507523pax.138.2012.11.21.01.13.23 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Nov 2012 01:13:48 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.48 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.48; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.48 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-f48.google.com with SMTP id rq13so5326887pbb.21 for ; Wed, 21 Nov 2012 01:13:23 -0800 (PST) Received: by 10.68.251.197 with SMTP id zm5mr56933375pbc.30.1353489203354; Wed, 21 Nov 2012 01:13:23 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id mn5sm9621802pbc.12.2012.11.21.01.13.20 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Nov 2012 01:13:22 -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 4/6] ALSA: usb: Fix potential NULL pointer dereference in comm.c Date: Wed, 21 Nov 2012 14:36:57 +0530 Message-Id: <1353488819-13902-4-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: ALoCoQl9SfdS+2aZDad5awoXVNgYa1Vj5piFksidIGTcod5bxdJ8duU5VZFPjCFGDCyxzThMd4b/ 'rt' was dereferenced before the NULL check. Moved the code after the check. Signed-off-by: Sachin Kamat --- Build tested and based on linux-next 20121115. --- sound/usb/6fire/comm.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/sound/usb/6fire/comm.c b/sound/usb/6fire/comm.c index 6c3d531..1a75c36 100644 --- a/sound/usb/6fire/comm.c +++ b/sound/usb/6fire/comm.c @@ -129,12 +129,13 @@ int __devinit usb6fire_comm_init(struct sfire_chip *chip) { struct comm_runtime *rt = kzalloc(sizeof(struct comm_runtime), GFP_KERNEL); - struct urb *urb = &rt->receiver; + struct urb *urb; int ret; if (!rt) return -ENOMEM; + urb = &rt->receiver; rt->serial = 1; rt->chip = chip; usb_init_urb(urb);