Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp700476pxb; Tue, 5 Apr 2022 19:21:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx45N2YD9YS5YJe+rAfCH8FTAb/KJ5v8a3T19mKWlvoddZj7x5nWD1RGSV/lkMvAKLVGX47 X-Received: by 2002:a05:6a00:14cb:b0:4fb:2c72:1fdc with SMTP id w11-20020a056a0014cb00b004fb2c721fdcmr6695533pfu.55.1649211562115; Tue, 05 Apr 2022 19:19:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649211562; cv=none; d=google.com; s=arc-20160816; b=h0AOfqIrqjVTz5rNOs1eOMWwgMn7hQeMtKtaxtyQg29Q1mkTzhajkbfNlsRFg7S05b vKam+vLFpz89dPh7AbjDlQy7Gqt7e03ub02FoUvqrFVI2wCsvtQMSY0MmPRHzTwhp+6T 3M4AHDpOsFiNRrjShaPygMmn/z0YG0dyOqK8eEFMBhTbtQw2rqov+3M1V1yGXxopEYgW Nwms/g89Krp3QVMC8uy6XHDXPnfNPJzoXC8jnh/IRvnXC4hPInVIU3TGb3NQburpUyI/ M2KR8mwx7CKnQPhH12789HVjnF6Ykf/91Js52ymoGudT8Q0X1OhmI/sdKkFaBQtVfKCg 6+JA== 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=JGnBgQW8q58+4/9E9qje3s98V0h2EJueEHywaEP4WTc=; b=pIE8aACeP9k2NGLXnlg3ULwokr8p9HKAIxmLtrq5Le5tCF4srybkCpRMJNxCYmkv6q kvt0ml9uMbqnJsYGvmPOU0FG9KrX0yF3W7kTlAqTrEWTgH9DJFbNXh/QHNEqUHgTQDWo CTf0D0SJaM9j5I2vSAdP7/R04L5rCArxOhhk3s7kmzSagjOrp0LuI0DLJOzqMboo0ef/ d5peDfJGub/Q7vfwvVnwRamcWIoNxHi0H29ajmdIGXjon8mZJ8DjC3hiysevoDhN+Ksq 3wg1qsPPbz5KIsoolwEeCuViXBcxQ380CPbqMRdmPBCrJ8/jUu8UdAZgV9P2YWvH9wQa q2eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D9SAbzx7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h11-20020a170902b94b00b00153f163b3c6si13149333pls.552.2022.04.05.19.19.06; Tue, 05 Apr 2022 19:19:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D9SAbzx7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235548AbiDEIXk (ORCPT + 99 others); Tue, 5 Apr 2022 04:23:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235539AbiDEH7u (ORCPT ); Tue, 5 Apr 2022 03:59:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C7A73F33C; Tue, 5 Apr 2022 00:55:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E104C615CD; Tue, 5 Apr 2022 07:55:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED31CC340EE; Tue, 5 Apr 2022 07:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649145312; bh=/lTgJhfMgUknakrtdkYLpkrDctVwfh45IIK+dT4dNuo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9SAbzx7XASKZ4ugr6VFrtYMIeLPJJN6sktPRKK5/fLjMOiP3bL5Sj8y4eEeS8XyV lIH4XRSSt8rTQpd6li653pmKNM2sqat3d6Yh7wRLUA9bhyUvJOLOhO9sEVbwD99DEW 495ToXJOC6MAwKcswsHhx53rrhWUUnYpMyjFk6sw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 5.17 0361/1126] ASoC: codecs: wc938x: fix accessing array out of bounds for enum type Date: Tue, 5 Apr 2022 09:18:28 +0200 Message-Id: <20220405070418.223863455@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Srinivas Kandagatla [ Upstream commit cc587b7c8fbbe128f6bd0dad025a0caea5e6d164 ] Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes. Fix this by using enumerated items instead of integers. Fixes: e8ba1e05bdc0 ("ASoC: codecs: wcd938x: add basic controls") Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220222183212.11580-7-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/wcd938x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index 36cbc66914f9..33d5403d4e62 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -2504,7 +2504,7 @@ static int wcd938x_tx_mode_get(struct snd_kcontrol *kcontrol, struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; int path = e->shift_l; - ucontrol->value.integer.value[0] = wcd938x->tx_mode[path]; + ucontrol->value.enumerated.item[0] = wcd938x->tx_mode[path]; return 0; } @@ -2528,7 +2528,7 @@ static int wcd938x_rx_hph_mode_get(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component); - ucontrol->value.integer.value[0] = wcd938x->hph_mode; + ucontrol->value.enumerated.item[0] = wcd938x->hph_mode; return 0; } -- 2.34.1