alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: mediatek: mt8186: set the correct string to strncmp()
@ 2022-07-26 15:31 Jiaxin Yu
  2022-07-26 17:50 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Jiaxin Yu @ 2022-07-26 15:31 UTC (permalink / raw)
  To: broonie, angelogioacchino.delregno, dan.carpenter
  Cc: alsa-devel, linux-kernel, Jiaxin Yu,
	Project_Global_Chrome_Upstream_Group, linux-mediatek, aaronyu,
	linux-arm-kernel

Fix Smatch static checker warning. strncmp() here only needs to compare
the first seven bytes, so in order to make the code more clear, only the
first seven bytes of the string used as the comparison are reserved.

Bug report: https://www.spinics.net/lists/alsa-devel/msg145608.html

sound/soc/mediatek/mt8186/mt8186-dai-adda.c:78 get_adda_priv_by_name()
warn: strncmp() with weird length: 17 vs 7

sound/soc/mediatek/mt8186/mt8186-dai-adda.c
    72 static struct mtk_afe_adda_priv *get_adda_priv_by_name(struct mtk_base_afe *afe,
    73                                                        const char *name)
    74 {
    75         struct mt8186_afe_private *afe_priv = afe->platform_priv;
    76         int dai_id;
    77
--> 78         if (strncmp(name, "aud_dac_hires_clk", 7) == 0 ||
    79             strncmp(name, "aud_adc_hires_clk", 7) == 0)

Fixes: b65c466220b3 ("ASoC: mediatek: mt8186: support adda in platform driver")
Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
---
 sound/soc/mediatek/mt8186/mt8186-dai-adda.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-adda.c b/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
index db71b032770d..81976f7c444e 100644
--- a/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
+++ b/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
@@ -75,8 +75,7 @@ static struct mtk_afe_adda_priv *get_adda_priv_by_name(struct mtk_base_afe *afe,
 	struct mt8186_afe_private *afe_priv = afe->platform_priv;
 	int dai_id;
 
-	if (strncmp(name, "aud_dac_hires_clk", 7) == 0 ||
-	    strncmp(name, "aud_adc_hires_clk", 7) == 0)
+	if (strncmp(name, "aud_dac", 7) == 0 || strncmp(name, "aud_adc", 7) == 0)
 		dai_id = MT8186_DAI_ADDA;
 	else
 		return NULL;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: mediatek: mt8186: set the correct string to strncmp()
  2022-07-26 15:31 [PATCH] ASoC: mediatek: mt8186: set the correct string to strncmp() Jiaxin Yu
@ 2022-07-26 17:50 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-07-26 17:50 UTC (permalink / raw)
  To: Jiaxin Yu, angelogioacchino.delregno, dan.carpenter
  Cc: alsa-devel, linux-kernel, Project_Global_Chrome_Upstream_Group,
	linux-mediatek, aaronyu, linux-arm-kernel

On Tue, 26 Jul 2022 23:31:30 +0800, Jiaxin Yu wrote:
> Fix Smatch static checker warning. strncmp() here only needs to compare
> the first seven bytes, so in order to make the code more clear, only the
> first seven bytes of the string used as the comparison are reserved.
> 
> Bug report: https://www.spinics.net/lists/alsa-devel/msg145608.html
> 
> sound/soc/mediatek/mt8186/mt8186-dai-adda.c:78 get_adda_priv_by_name()
> warn: strncmp() with weird length: 17 vs 7
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: mediatek: mt8186: set the correct string to strncmp()
      commit: 7df92384c86f36d0452e7abad21c7eaa91aeeef7

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-26 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-26 15:31 [PATCH] ASoC: mediatek: mt8186: set the correct string to strncmp() Jiaxin Yu
2022-07-26 17:50 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).