Received: by 10.223.185.116 with SMTP id b49csp1092758wrg; Fri, 23 Feb 2018 11:48:31 -0800 (PST) X-Google-Smtp-Source: AH8x2269w9pvBGmIGixAMjgqHUettvJkcScSMK3m/shCmBGhd19iejZ1ACskSmNEaSVFtcL4Bkxk X-Received: by 2002:a17:902:149:: with SMTP id 67-v6mr2673030plb.73.1519415311562; Fri, 23 Feb 2018 11:48:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519415311; cv=none; d=google.com; s=arc-20160816; b=BWLolRuneAKZKA9yCqaL7vV7CIoVulwSs7JAI5BMudRyFWrgtFyqn+mjqEOShAisqq Yl5noseUXdExhTqp2aM1nICIt0Jr/SA+m2PJ0wgbXN9Aqeeou1wC3nOQTS8SMhpBKRwE iUfulbQmjLMO/jjJKFV6gFJs974js6t4QW8hjJ9hS6yC4G2SxzQnAoZ9jaGk/yPRGh6l miMOUJ9z1IosLle5X5NGgL5mwudD/hTvYGozk6GlTwp456l+1vjl5uUj2KWUQXP06R5O z7jy/OSfryaDU9g1+Q2cjOerztD5lHw4S8N9bj1X3EbPoO45oW7fDy0ZHnFVboQ/F3e9 QHuw== 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=9nUFy09HcWepBy3Yag++gd+mhjluqvTmh2eo21IHtkg=; b=N3Z5/GDylSQlM9GON1Ts6v6Im6//u9tTma5b22p5NLv90gp1QeXLL9KOIYK5aYU1Xj IWb7J9GTESKKhwuRQkQajW/U/3ZaQW06hQgA251WY1zMwPy2y9xPhnXqaWvY2pkuY/WY RX2Ju6VnB7XjL4j18uJB6rzDSMxq9zr2cdzMikLAPGRlGWde0BAefwBJ9YXzmhrcfiAw XM8fesUDQkqBkksoNVo5zv1hEns4YGKbRxtEX6bslmHu7vvaCEmD+BvXlRAbP2q3NuVE vNunqdQDOD/2XfR4dmnDrTbhPiy0V8kxMwNx0KVksxCMZXQ+jWGB3qS1scPKfXEzI9KL z2BA== 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 w5-v6si2174785plz.551.2018.02.23.11.48.16; Fri, 23 Feb 2018 11:48:31 -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 S934209AbeBWSrj (ORCPT + 99 others); Fri, 23 Feb 2018 13:47:39 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:44600 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933859AbeBWSrg (ORCPT ); Fri, 23 Feb 2018 13:47:36 -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 1D7B4FC6; Fri, 23 Feb 2018 18:47:35 +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.9 117/145] ALSA: hda/ca0132 - fix possible NULL pointer use Date: Fri, 23 Feb 2018 19:27:03 +0100 Message-Id: <20180223170739.958889642@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170724.669759283@linuxfoundation.org> References: <20180223170724.669759283@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.9-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);