From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81BBF3EC805; Fri, 9 Oct 2026 14:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791556289; cv=none; b=SFkpyztLAxRcld489yY7U4/9v/Kaqlvs4G0Akgyvv3aUZ7R5OwJGahUPs4EpNymVcflOKGfuEAsA8I+3p1c0zlvsUD0+KWwhrNZeXD7EG6ud3AUG6GNRwb/Otgb9Ypn/tNIS2EBo/9It9+EHIlRc+F1bGQ5N3d4lPdQb+2Jm6jw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791556289; c=relaxed/simple; bh=00Vtl3kbOqwtmpqZOSHAFpQFd0fAIHRgTTsFluMXf10=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MFtUWZponsnZcV4k2Q/lDWSlQLUpC1MW1MJBlKW0J9mDRO5K7mkeMPCGW2dgmDqnW2s+6k8Hl3yljn+M0N/fTYUP7U+ZTvwns0eX7741ZQ/ekjziBsiNo+yDCrzZeW6A7G1U6qy1U1ja2EPfjuxpjxL4GC0+7ZwjnrtVQ/U77lk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=m27Pltw6; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="m27Pltw6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAE9B1F000FF; Fri, 9 Oct 2026 14:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791556288; bh=eeKLj3Tr4fF5LjKyl7qDlFigAciVvsPTlK1ExEGrIwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=m27Pltw6VJcnJQFxO0ieXVq9jJVXbyYf1tyosGsnc/7jbYNVkTfvSbgXFbKe29r+t ZKPgnplN9UVVjzcG5hCjeC44zx2OEYQkpPgYbMn9ziFldIanc2n+BOYnlBr3+fmAjY pi9598QrhXfiLlS5YMV1ETgs3o/Pq1BQf+MbQB70= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiangshan Yi , Mark Brown Subject: [PATCH 6.18 210/403] ASoC: codecs: rt1017-sdca-sdw: fix uninitialized stream_config->type Date: Fri, 9 Oct 2026 16:09:31 +0200 Message-ID: <20261009140957.051870951@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140952.119038291@linuxfoundation.org> References: <20261009140952.119038291@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiangshan Yi commit 174d160884199cad97413f33fe1b56027dc0d3e1 upstream. stream_config is not initialized before being passed to sdw_stream_add_slave(). The type field may contain garbage and is later copied to stream->type by sdw_config_stream(). Zero-initialize stream_config so type defaults to SDW_STREAM_PCM. While at it, use snd_sdw_params_to_config() helper instead of open-coding the same logic. Fixes: 2b7aecd58528 ("ASoC: rt1017: Add RT1017 SDCA amplifier driver") Cc: stable@vger.kernel.org Signed-off-by: Jiangshan Yi Link: https://patch.msgid.link/20260914104551.377880-1-yijiangshan@kylinos.cn Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- sound/soc/codecs/rt1017-sdca-sdw.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) --- a/sound/soc/codecs/rt1017-sdca-sdw.c +++ b/sound/soc/codecs/rt1017-sdca-sdw.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -574,11 +575,10 @@ static int rt1017_sdca_pcm_hw_params(str { struct snd_soc_component *component = dai->component; struct rt1017_sdca_priv *rt1017 = snd_soc_component_get_drvdata(component); - struct sdw_stream_config stream_config; + struct sdw_stream_config stream_config = {0}; struct sdw_port_config port_config; - enum sdw_data_direction direction; struct sdw_stream_runtime *sdw_stream; - int retval, port, num_channels, ch_mask; + int retval, port; unsigned int sampling_rate; dev_dbg(dai->dev, "%s %s", __func__, dai->name); @@ -592,28 +592,17 @@ static int rt1017_sdca_pcm_hw_params(str /* SoundWire specific configuration */ /* port 1 for playback */ - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { - direction = SDW_DATA_DIR_RX; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) port = 1; - } else { - direction = SDW_DATA_DIR_TX; + else port = 2; - } - - num_channels = params_channels(params); - ch_mask = (1 << num_channels) - 1; - - stream_config.frame_rate = params_rate(params); - stream_config.ch_count = num_channels; - stream_config.bps = snd_pcm_format_width(params_format(params)); - stream_config.direction = direction; - port_config.ch_mask = ch_mask; + snd_sdw_params_to_config(substream, params, &stream_config, &port_config); port_config.num = port; dev_dbg(dai->dev, "frame_rate %d, ch_count %d, bps %d, direction %d, ch_mask %d, port: %d\n", - params_rate(params), num_channels, snd_pcm_format_width(params_format(params)), - direction, ch_mask, port); + stream_config.frame_rate, stream_config.ch_count, stream_config.bps, + stream_config.direction, port_config.ch_mask, port); retval = sdw_stream_add_slave(rt1017->sdw_slave, &stream_config, &port_config, 1, sdw_stream);