Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6b98c492 authored by Abinath S's avatar Abinath S
Browse files

asoc: Fix out-of-bound write



Modified check to avoid out-of-bound write.

Change-Id: Ife5454d8de74b603291d3c129f03f1b901c6de8b
Signed-off-by: default avatarAbinath S <quic_abins@quicinc.com>
parent 1bf72834
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022, 2024 Qualcomm Innovation Center, Inc. All rights reserved.
 */


@@ -3950,7 +3950,7 @@ static int msm_compr_channel_map_put(struct snd_kcontrol *kcontrol,

	pr_debug("%s: fe_id- %llu\n", __func__, fe_id);

	if (fe_id >= MSM_FRONTEND_DAI_MM_SIZE) {
	if (fe_id >= MSM_FRONTEND_DAI_MAX) {
		pr_err("%s Received out of bounds fe_id %llu\n",
			__func__, fe_id);
		rc = -EINVAL;
@@ -3992,7 +3992,7 @@ static int msm_compr_channel_map_get(struct snd_kcontrol *kcontrol,
	int rc = 0, i;

	pr_debug("%s: fe_id- %llu\n", __func__, fe_id);
	if (fe_id >= MSM_FRONTEND_DAI_MM_SIZE) {
	if (fe_id >= MSM_FRONTEND_DAI_MAX) {
		pr_err("%s: Received out of bounds fe_id %llu\n",
			__func__, fe_id);
		rc = -EINVAL;
+3 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
 */
#include <linux/init.h>
@@ -1656,7 +1656,7 @@ static int msm_pcm_routing_channel_mixer_v2(int fe_id, bool perf_mode,
	int j = 0, be_id = 0;
	int ret = 0;
	if (fe_id >= MSM_FRONTEND_DAI_MM_SIZE) {
	if (fe_id >= MSM_FRONTEND_DAI_MAX) {
		pr_err("%s: invalid FE %d\n", __func__, fe_id);
		return 0;
	}
@@ -1723,7 +1723,7 @@ static int msm_pcm_routing_channel_mixer(int fe_id, bool perf_mode,
		return ret;
	}
	if (fe_id >= MSM_FRONTEND_DAI_MM_SIZE) {
	if (fe_id >= MSM_FRONTEND_DAI_MAX) {
		pr_err("%s: invalid FE %d\n", __func__, fe_id);
		return 0;
	}
+2 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
 */

#include <linux/err.h>
@@ -179,7 +180,7 @@ static int msm_qti_pp_put_dtmf_module_enable

	fe_id = ((struct soc_multi_mixer_control *)
			kcontrol->private_value)->shift;
	if (fe_id >= MSM_FRONTEND_DAI_MM_SIZE) {
	if (fe_id >= MSM_FRONTEND_DAI_MAX) {
		pr_err("%s: invalid FE %d\n", __func__, fe_id);
		return -EINVAL;
	}