Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp971121pxb; Wed, 6 Apr 2022 05:40:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyewaVgE0hT7ZGUksjEh5InL8rmc9tAJC+MBuTesNbMzATt4RuKw6E4ciTsPXasPxZe73PH X-Received: by 2002:a17:903:244b:b0:154:4104:4668 with SMTP id l11-20020a170903244b00b0015441044668mr8469293pls.30.1649248856301; Wed, 06 Apr 2022 05:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649248856; cv=none; d=google.com; s=arc-20160816; b=Cuvdgh2NfD+wNwG1ZJKZjMxRuJ8GUaUGF+iEj+sOZl5S54rO7uIgrhjIq4JYvD+hK1 ncK+vdz5aoqmyNH0tjRCiMhWAthG0MfqtPZsRMPiqPAcsVwvktqkxd+YV4wZ77rYg2B1 pE8QbTs2af71K2jcoA/oqrnckAVcusob+6oh8cVg1l/DdzlU/5oAqRBpcLijIC7bDu0T ty4n9KQfpS/l5mjm9/bNgBR33gEZqA8RHE9h9DVNQNxspZQ3G8rUgMhp/O7k6aSFMhrm +f0PKnTbgTIp38z0156eveA+ef6m9LS4ZzBxqdSxasflFws0V0nO3ZOxXSK9yS8OL292 k9yA== 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=7u7Il0RadRLlYxYGi8FRE/kxUQ2GZzanaUFlzuOhRiY=; b=ONOtDy6j5D42scj73QlRkgz7LNX+Lz4nS6Pl4RK0W4ZYsCOrv2T9qS34Hi/kkFrbaN WH3wyQ7V3GNeoCsTsh9ilUWoOuIqNW6ZszKJTqT+xVaSwcGu4je6qzvdFu3OUyyr8JxT EEIt8lxSMDA1/iVTJhJJL/TzdKupsy4gJfFcTh9m1GgqjlmlpKB5qoxnBqEulgbIybkf o3SvaUudKoje36CKdHZ5vjaGk/OzdAhyxn9xQMz2vltVVlcGuBiHI/MpNcKAhrbrMTL9 uY7gla6AJP4lS7xDwAMHwU0uJR929iQjAhqYpyiBJeuP28DTHwWxUM+mAXrZgczL9Yf6 wNmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hzau5B5b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id qe11-20020a17090b4f8b00b001c685a30dddsi5503694pjb.33.2022.04.06.05.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:40:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hzau5B5b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C5C5C5AE2CA; Wed, 6 Apr 2022 02:16:29 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1837283AbiDFApX (ORCPT + 99 others); Tue, 5 Apr 2022 20:45:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347690AbiDEJqj (ORCPT ); Tue, 5 Apr 2022 05:46:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 294DEDFD49; Tue, 5 Apr 2022 02:32:59 -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 ams.source.kernel.org (Postfix) with ESMTPS id 7CEFFB81C8B; Tue, 5 Apr 2022 09:32:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5B44C385A2; Tue, 5 Apr 2022 09:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151176; bh=UtAF4TJdgd6LI56pIhGRnVTmygJzn7Y55xHYTWv0Fco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hzau5B5b0J8vv6tG5YKIQlzlekWPylQ2Mfz7MaECCnF0qES2D5CrI0HEBt60RWof0 eFEoU3am/Y5uQOnjrhuW0IBVWIA/fibtlDkx5VMH3L4OSP7kxKtGjCa952EiE8cjOZ jgMsARjsoZ/1SSSh7cYukoRdIIf3MhxMPV1KROR8= 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.15 320/913] ASoC: codecs: wc938x: fix accessing array out of bounds for enum type Date: Tue, 5 Apr 2022 09:23:02 +0200 Message-Id: <20220405070349.442730334@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 bbc261ab2025..54671bbf7471 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