From patchwork Tue Oct 3 15:54:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 147969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp2180640vqb; Tue, 3 Oct 2023 08:54:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFnSKGwWdXQYwiW1cHzLjkW8Nd9Few6zy06Azi+kmxu2GFqSrE9TMwC4Uj27iS7emHJFSho X-Received: by 2002:a05:6808:d4d:b0:3a7:c2e8:5e7c with SMTP id w13-20020a0568080d4d00b003a7c2e85e7cmr19252993oik.43.1696348475489; Tue, 03 Oct 2023 08:54:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696348475; cv=none; d=google.com; s=arc-20160816; b=GAMCl+aSnJO8JUEs5CQ5IapGEbjGCpKcB8RwSkZGFSwEWvLaJGDxPxK+Mz8eQADB3Y rO+KZB4DcF4FVnfDnPQ954ibCgfAdxjhxE4+RgDWJ2eD0OVrNekSweODI+vwdkx4Kj85 f9fKAKuTCAedKvuddhRbA3t9OEnN/JInX8gEsgyVcXmc6lduFD04VisG+2/g9B2h5tlC aQdq9TUiWKkRnM/o0P0O/XuzpohuuS55GW2uHT8JEhHGEEGYE8q3RJgJPTF1lXpBOME3 86UPVOSLjzG6MgnAxY2uQgd2npvJCEJHQySUAYynArA6B3cqpyvFeQL3cGO8YyTPJi4G B4Lg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=9qwggqM5g4H2kMBZ1deteV2yt6E9yc4Vqh+Tp6Hnvgo=; fh=4rPxwDWQKK7ad6pk7tUiBz6AU+mSkx1vcYxMTkAwzzQ=; b=J/h9AhTWI0hZA6+xen0fy9g7JRKPodQoFtqoMoXdCpChFftYDyTuMBtGIuDkqluV8V +R2e1t4jjon8AjpJIJKSbeKtHTQdTlvbtUtfJDei1xLQ0AuAwQ2GZDJxDuitzTTwu4B+ YZ838MIS6DHU6HcgMv0nFPPw7mUZNI4Bu1tPkrydCTjBLD/jIs4DCM/4djWUtH2aWWL+ CjMc9KWnZlFA7RM/t4DBjOXJQIrUyhN4HVCknp8uinItGypnwqniRnosSMtdbMSV1brX Tw2W+GuW2LFnA/VmVGYVrRZPbuIApsqYEmcD/IkKpQlN1wzxXlZYH6n9VKZOEGQWHnZ7 8xYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mmaSiZcC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id ha18-20020a17090af3d200b00278f2f6b412si9988222pjb.164.2023.10.03.08.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 08:54:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mmaSiZcC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 46DC682BB18A; Tue, 3 Oct 2023 08:54:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231733AbjJCPyd (ORCPT + 17 others); Tue, 3 Oct 2023 11:54:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231888AbjJCPyb (ORCPT ); Tue, 3 Oct 2023 11:54:31 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2559FBF for ; Tue, 3 Oct 2023 08:54:27 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-9ad810be221so204846966b.2 for ; Tue, 03 Oct 2023 08:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1696348465; x=1696953265; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9qwggqM5g4H2kMBZ1deteV2yt6E9yc4Vqh+Tp6Hnvgo=; b=mmaSiZcCH+DXUmz09lDemy233/CUEnRFt4ROlBjTnoPtncwzi3DvB120qaewocHnCa LKj4R+yOVHAGZHHvqruATzl7ZPqdd68v1FBvvFCfOJWilwivm0HVQbbenGFzyF/gnlEm t5rt2qq7Jh7kgwydcNP5O/CUL8GP93x723YSqDny1Mml67Fx4gX646D1FToTd/2M3blD N+7EdNsQfwixdYxz/W09XwFXpnf2VwSfvcr4rpg04SRS/vkmFlexE45C6WUYK98NB/Oa DFbWpuElM0PBr+/NHT+FZ/Cz0ROwZ7aUdGLKJw2BUgEG2mX0FVTtPYV4vRHaFHzOqtSj nv5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696348465; x=1696953265; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9qwggqM5g4H2kMBZ1deteV2yt6E9yc4Vqh+Tp6Hnvgo=; b=T0UzczyxwWZbrVLH7TWDSieSS9IFYqPYHY+34WAUfuDZwDGO4T2b9AhyBTDxSmciYs 0wb2Vg1oYH4nbcFBxJ41YmcXB/WVKs3e6iHZNBRJPu8EL4lMRolLUebyHcypsZ9rXWNX 6eWVkxTYJQGJXc2H7kxgyPXEKdFchwp2Hnvn7Hnc13Mv06YI12b5d+N39x7OnJeFNJ5K p9Ee5RhaLm0yCI2zsofxVmDceBWATLPcSuXGSg5B2blUQe852Ihm49pjSyfVacY7JPDv UozrNROPFmfJFmcxqo8bjObXkHuKpZYcJ1cnJexr760phmHHki2wZWpIhviKej9QQM5l whQg== X-Gm-Message-State: AOJu0YxALlnRamfwR+9AbmUpOgRbXvRKw80Q0NDFaXLW49B8s/HbGAbK We9G4DTku4/Hc7DarD5fQGk8ag== X-Received: by 2002:a17:906:5349:b0:9b2:9a0e:9973 with SMTP id j9-20020a170906534900b009b29a0e9973mr13823175ejo.42.1696348465487; Tue, 03 Oct 2023 08:54:25 -0700 (PDT) Received: from krzk-bin.. (5-157-101-10.dyn.eolo.it. [5.157.101.10]) by smtp.gmail.com with ESMTPSA id sa18-20020a170906edb200b0098733a40bb7sm1268948ejb.155.2023.10.03.08.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 08:54:25 -0700 (PDT) From: Krzysztof Kozlowski To: Srinivas Kandagatla , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , stable@vger.kernel.org Subject: [PATCH] ASoC: codecs: wsa-macro: fix uninitialized stack variables with name prefix Date: Tue, 3 Oct 2023 17:54:22 +0200 Message-Id: <20231003155422.801160-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 03 Oct 2023 08:54:34 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778750299324775548 X-GMAIL-MSGID: 1778750299324775548 Driver compares widget name in wsa_macro_spk_boost_event() widget event callback, however it does not handle component's name prefix. This leads to using uninitialized stack variables as registers and register values. Handle gracefully such case. Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and route") Cc: Signed-off-by: Krzysztof Kozlowski --- This is a fix only for uninitialized values case. The fix for including name prefixes will be sent separate, because I think it is not a stable material. Happy to combine patches if needed. --- sound/soc/codecs/lpass-wsa-macro.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c index ec6859ec0d38..ea6e3fa7e9e1 100644 --- a/sound/soc/codecs/lpass-wsa-macro.c +++ b/sound/soc/codecs/lpass-wsa-macro.c @@ -1685,6 +1685,9 @@ static int wsa_macro_spk_boost_event(struct snd_soc_dapm_widget *w, boost_path_cfg1 = CDC_WSA_RX1_RX_PATH_CFG1; reg = CDC_WSA_RX1_RX_PATH_CTL; reg_mix = CDC_WSA_RX1_RX_PATH_MIX_CTL; + } else { + dev_warn(component->dev, "Incorrect widget name in the driver\n"); + return -EINVAL; } switch (event) {