Received: by 10.223.185.116 with SMTP id b49csp1127837wrg; Fri, 23 Feb 2018 12:25:09 -0800 (PST) X-Google-Smtp-Source: AH8x2257a2/qeOFORlfQj6ajWsVgf2S7VM0FW+vnqY1tPLbw3yheyAlbS6nSstm+V+7Y3f0yXsVq X-Received: by 2002:a17:902:4d46:: with SMTP id o6-v6mr2735726plh.166.1519417509440; Fri, 23 Feb 2018 12:25:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519417509; cv=none; d=google.com; s=arc-20160816; b=uDUcareKkYZJKFPC/z6HPyBbvfPvrcxT1UEY0mdNHAU2KYT0qjGpasnkwATyYkr+IG fEyNhAXjA8xtYnikenVxP5QNeHRBTVDX0HmRo7HWKaTai+sohv7HY8IA6iJDSePbDq7E vQRWUcD69zfj3p1m4lYP55imda+QQ740uZ7wHvJ1AjN0Tzn5VTeP9hYWYtqsnRed/OOI nExZkD50D80NazPwSmQ8uvmxLAsCMMornJA/oe0e+22UduG6DQqc/cH/Wd0x09T5IAnL sRujmkEkSK7Qp9kSOTS+EwYNj8xMwW3RrYf8sE7PzzdKYEb3fQSgPG/Kh6x/QrpNBUoq 5bMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=EribfEtsgEYx/uGeIQ4T3mpLYqe5c20F8XWyyzYwDVU=; b=B585VUOluhLBTzzcQQra4x7DLRIBmUzB4I7OwQ8GLXCduDg4bKqI0K+wUStQZ59WwL 7mJ4GpoJA5whjF7xuQOwbaxxqdSWUl0zfJz63E9LNPCtVUAyQWJXW0wsbIXZu5xEVgcZ QW+DUBj7889XMD1Kq3r/hOmMdM83Wy4HYCKs3H9zG8ABSO/7tmilnDkYHDZ03yGfE869 w0AbWs84iKaS/UbjEhkoCOoUZBQvCCYDzSApgmCbXyDzyJjBlBgMboq8sc5Eyv/nT17x xK4XQKI8j84lvh7N+qsomwCd4hO7rQp9hgPUYWcgFdfcvF39UtRPg4dy3G4ToXB1HlXS Z64g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r6si2311867pfl.304.2018.02.23.12.24.55; Fri, 23 Feb 2018 12:25:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754303AbeBWSiM (ORCPT + 99 others); Fri, 23 Feb 2018 13:38:12 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:38892 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753841AbeBWSiI (ORCPT ); Fri, 23 Feb 2018 13:38:08 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 4B8E9FDC; Fri, 23 Feb 2018 18:38:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , Takashi Iwai Subject: [PATCH 4.4 079/193] ALSA: hda/ca0132 - fix possible NULL pointer use Date: Fri, 23 Feb 2018 19:25:12 +0100 Message-Id: <20180223170338.418889960@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170325.997716448@linuxfoundation.org> References: <20180223170325.997716448@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit 46a049dae771b95e77ac6c823330f4a60f600236 upstream. gcc-7 caught what it considers a NULL pointer dereference: sound/pci/hda/patch_ca0132.c: In function 'dspio_scp.constprop': sound/pci/hda/patch_ca0132.c:1487:4: error: argument 1 null where non-null expected [-Werror=nonnull] This is plausible from looking at the function, as we compare 'reply' to NULL earlier in it. I have not tried to analyze if there are constraints that make it impossible to hit the bug, but adding another NULL check in the end kills the warning and makes the function more robust. Signed-off-by: Arnd Bergmann Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/patch_ca0132.c | 3 +++ 1 file changed, 3 insertions(+) --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -1482,6 +1482,9 @@ static int dspio_scp(struct hda_codec *c } else if (ret_size != reply_data_size) { codec_dbg(codec, "RetLen and HdrLen .NE.\n"); return -EINVAL; + } else if (!reply) { + codec_dbg(codec, "NULL reply\n"); + return -EINVAL; } else { *reply_len = ret_size*sizeof(unsigned int); memcpy(reply, scp_reply.data, *reply_len);