Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1001754pxb; Wed, 6 Apr 2022 06:27:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8sQN8JZbIkkvtPFIFKJG82FtNisVkmEU7e2s8oWaXFBdwzrsc3CzPLMCdQQ2gTpdjB2EH X-Received: by 2002:a63:6f85:0:b0:398:3e74:bdd8 with SMTP id k127-20020a636f85000000b003983e74bdd8mr7091338pgc.423.1649251651122; Wed, 06 Apr 2022 06:27:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649251651; cv=none; d=google.com; s=arc-20160816; b=JwCfk7qnLBKKxXrEVynT86Scnmpj1DAGGMVEw2DQ+tvC09UPQOMbqaRU4yxD8sAnjW 1TxqwH8KoU1Qn0srllPCykx88iJeuEpSxHrfCWtPk8XPAK+mVGfnWR4cztDGjGg9/bvr z+ZMTsBnDRgu1nuxIvPGbTBw05pdslp7uB3M3RpL6AqVLGvxXY1JR5ssl3IXJRC8mNwa CgbgL/VRRf4srgw5VcNvjR7FDEylYPkK3YToaTjp3qu/fszfvjr3pvUnGtMWT9y6+TCv vaNqrTJu7DbYjYKliKo4TzsBT43ECAiA7ogUOIcA4aFAgHjBFpSZ2EHE6NcASxFFXm9r UiQQ== 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=h6DIjY3m3zYsHSARNMxv1ceQAymxtz27t4S+GKATY3U=; b=KBZa9abjfwSjc89reW04iLs08XLfrwTKV2qNJ6HYa1PUOJIs7irJvw5cqw+VEdpWqR StFjre/4m9YUqmW8wdq2Qf9j8sECE1SU8gd1AqOTeT9hw/il+ExENBTQUu4ygp4N1wDx Xg+YuCsLf0BVDch1Ar0F3oKP0VJS/tKFIjgIUvVLNdOs2OivHjrQbKKIId5/+kBAgwID AotE7SAH6FwdlScbziB84ESU8WavaXaDxCtsV7gE3qaDPPDLwj3jiVBp91zHa41rsYKJ YQjYXEEj+BOgXRGl/xbs9mX5/0KJqICMzFQAPf+JiGGNjdTbwR2iaU9DIi4+xX52ad9y B/rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="ZgM+R6V/"; 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 x6-20020a1709027c0600b00153b2d16435si10921385pll.61.2022.04.06.06.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:27:31 -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="ZgM+R6V/"; 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E16284A8020; Wed, 6 Apr 2022 04:04:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389862AbiDEP1n (ORCPT + 99 others); Tue, 5 Apr 2022 11:27:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347363AbiDEJq0 (ORCPT ); Tue, 5 Apr 2022 05:46:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE637DEB8E; Tue, 5 Apr 2022 02:32:51 -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 3BD10616AE; Tue, 5 Apr 2022 09:32:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48275C385A0; Tue, 5 Apr 2022 09:32:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151170; bh=w6FuNmjk0ktzg+89KqvBnzyKkTm7FYtqo88XXdFIqus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZgM+R6V/nDd+pA4yxm1jbRpjrgT9qCYwGmnh7ny6wbOCv0elWTyEL/kAhNOZ3dIKe LB6ot+KzC44VgIHeHq7Hj7jvoHwUsIsWqK1DaOw2sz0gF0g/wDvvQOI2oSJAbJMLfR d4HCM7fNA17y/acA4PYt+pw5Rhw4+wHvc3vsI7+o= 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 318/913] ASoC: codecs: rx-macro: fix accessing array out of bounds for enum type Date: Tue, 5 Apr 2022 09:23:00 +0200 Message-Id: <20220405070349.384127387@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 bcfe5f76cc4051ea3f9eb5d2c8ea621641f290a5 ] 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. Fixes: 4f692926f562 ("ASoC: codecs: lpass-rx-macro: add dapm widgets and route") Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220222183212.11580-3-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/lpass-rx-macro.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c index fafb8265dbb3..23452900b9ae 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -2272,7 +2272,7 @@ static int rx_macro_mux_get(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); struct rx_macro *rx = snd_soc_component_get_drvdata(component); - ucontrol->value.integer.value[0] = + ucontrol->value.enumerated.item[0] = rx->rx_port_value[widget->shift]; return 0; } @@ -2284,7 +2284,7 @@ static int rx_macro_mux_put(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_dapm_to_component(widget->dapm); struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; struct snd_soc_dapm_update *update = NULL; - u32 rx_port_value = ucontrol->value.integer.value[0]; + u32 rx_port_value = ucontrol->value.enumerated.item[0]; u32 aif_rst; struct rx_macro *rx = snd_soc_component_get_drvdata(component); @@ -2396,7 +2396,7 @@ static int rx_macro_get_hph_pwr_mode(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct rx_macro *rx = snd_soc_component_get_drvdata(component); - ucontrol->value.integer.value[0] = rx->hph_pwr_mode; + ucontrol->value.enumerated.item[0] = rx->hph_pwr_mode; return 0; } @@ -2406,7 +2406,7 @@ static int rx_macro_put_hph_pwr_mode(struct snd_kcontrol *kcontrol, struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); struct rx_macro *rx = snd_soc_component_get_drvdata(component); - rx->hph_pwr_mode = ucontrol->value.integer.value[0]; + rx->hph_pwr_mode = ucontrol->value.enumerated.item[0]; return 0; } -- 2.34.1