Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp309735pxj; Thu, 20 May 2021 09:49:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzL71alJt0rlEbrM2NYCOQ2DhyO7Vcz7n7U2dlYGEAvFtdxInPCoLyAwmZSPPjW7dKwJLyG X-Received: by 2002:a17:906:d1d1:: with SMTP id bs17mr5638111ejb.492.1621529347280; Thu, 20 May 2021 09:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621529347; cv=none; d=google.com; s=arc-20160816; b=Y1pkQ9KlaaxdaYfzvNc9BaOyKCOgt/Lx5IchoDwRyWkLx4bpVv9MY8XohaWL+BJDf7 YOCSZ7gOQI/8o5zIAUwm3KnFNwRdGjrQI0pXOEQgu9dqUqS2yHUHhWvjl2Ok5dVedoGK RoP9Qylx9NJHpi8y74WzSsacjiin+HOMRzB9GALuo4iPEKczfOQwpiNd0Wy9PcBVfs8+ RUQd1FUBQh+U6SBbebgzOgZ9ICzFN4vJ2/g/2ZQf1Y/eN33BCgiTY1Xu5ljXaGF/sEv/ X3lhoFtXhhAaBhBoFpZ6A0LWN9sue6rU//VYxuCgRhG4Qp8SKNNYnHTqinVMr3PJox4S +mbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eewiFJPTKUe/ch/+SOVRrmB7XTdf+IDG2Rfand14R+8=; b=boqKPsIuTLwmANZsoOeW3QcS8ie8fQla++PZJaf8AVFiXsbJ/1Z6w+JD6fBPL1myoa aIQSTImpOQIVgCTopcbxLYwmEfDAkyTdKRz5WFHlVrZIdqsbBLuOgLRkWltB1ObsyYjy YibVFx9lTdqi92Cqupd6g7X8Jbdpw0WZgpJnqtVB+r8lub4n8CfPxBNW7vZKcNpMxtuj bxc4KcmGqzURDocN1QL7TGUC9FMaHCZsxTIWgNgUEBMG1vAVRVQY7uZcTlDj6/op9hlQ /yrJbnHpXOt/0wzEnl92VYom6k+KBicIMEUH6+J3N9IL+qSdFJGNHldJZTl/QE1QuwvJ ApQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ENjNq/Jm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n15si2917778edy.288.2021.05.20.09.48.42; Thu, 20 May 2021 09:49:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ENjNq/Jm"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233830AbhETJtG (ORCPT + 99 others); Thu, 20 May 2021 05:49:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:46030 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232244AbhETJqh (ORCPT ); Thu, 20 May 2021 05:46:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AB9266145C; Thu, 20 May 2021 09:33:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621503239; bh=vY+qJ9L0snUC9/P7fNq23yj/18U4hh5LcVJsNetmqQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ENjNq/JmnWK4kVpBwp8JghIW9ezVba0N2JGm2i8DKB1bRFkcwOK19qZTS2BQpV8ho F3EZYWx0aD2J/23fSzN1lC+9A6olNNhEY8nNOMGTHYMta5Pvvxs3hZB4/3KcPSPxpb bLIbRZK8L3E1dSfoHug+Nx+UcgzEFr2tQ7ZLJJco= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Krzysztof Kozlowski , Sylwester Nawrocki , Pierre-Louis Bossart , Mark Brown Subject: [PATCH 4.19 131/425] ASoC: samsung: tm2_wm5110: check of of_parse return value Date: Thu, 20 May 2021 11:18:20 +0200 Message-Id: <20210520092135.739497881@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092131.308959589@linuxfoundation.org> References: <20210520092131.308959589@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart commit d58970da324732686529655c21791cef0ee547c4 upstream. cppcheck warning: sound/soc/samsung/tm2_wm5110.c:605:6: style: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment] ret = devm_snd_soc_register_component(dev, &tm2_component, ^ sound/soc/samsung/tm2_wm5110.c:554:7: note: ret is assigned ret = of_parse_phandle_with_args(dev->of_node, "i2s-controller", ^ sound/soc/samsung/tm2_wm5110.c:605:6: note: ret is overwritten ret = devm_snd_soc_register_component(dev, &tm2_component, ^ The args is a stack variable, so it could have junk (uninitialized) therefore args.np could have a non-NULL and random value even though property was missing. Later could trigger invalid pointer dereference. There's no need to check for args.np because args.np won't be initialized on errors. Fixes: 8d1513cef51a ("ASoC: samsung: Add support for HDMI audio on TM2 board") Cc: Suggested-by: Krzysztof Kozlowski Reviewed-by: Krzysztof Kozlowski Reviewed-by: Sylwester Nawrocki Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20210312180231.2741-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/samsung/tm2_wm5110.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/sound/soc/samsung/tm2_wm5110.c +++ b/sound/soc/samsung/tm2_wm5110.c @@ -541,7 +541,7 @@ static int tm2_probe(struct platform_dev ret = of_parse_phandle_with_args(dev->of_node, "i2s-controller", cells_name, i, &args); - if (!args.np) { + if (ret) { dev_err(dev, "i2s-controller property parse error: %d\n", i); ret = -EINVAL; goto dai_node_put;