Skip to contentSkip to conversation

ASoC: codecs: hdac_hdmi: Fix incorrect use of list_for_each_entry

PATCH In review Amadeusz Sławiński 2 participants 5 messages Apr 15, 2020 – Apr 16, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ASoC: codecs: hdac_hdmi: Fix incorrect use of list_for_each_entry

If we don't find any pcm, pcm will point at address at an offset from the the list head and not a meaningful structure. Fix this by returning correct pcm if found and NULL if not. Found with coccinelle.

---
 sound/soc/codecs/hdac_hdmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/hdac_hdmi.c +3 -3
index fba9b749839d..f26b77faed59 100644
@@ -142,14 +142,14 @@ static struct hdac_hdmi_pcm *
 hdac_hdmi_get_pcm_from_cvt(struct hdac_hdmi_priv *hdmi,
 			   struct hdac_hdmi_cvt *cvt)
 {
-	struct hdac_hdmi_pcm *pcm = NULL;
+	struct hdac_hdmi_pcm *pcm;
 
 	list_for_each_entry(pcm, &hdmi->pcm_list, head) {
 		if (pcm->cvt == cvt)
-			break;
+			return pcm;
 	}
 
-	return pcm;
+	return NULL;
 }
 
 static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 3 lines · Amadeusz Sławiński

If we don't find any pcm, pcm will point at address at an offset from the the list head and not a meaningful structure. Fix this by returning correct pcm if found and NULL if not. Found with coccinelle.

I only have patch 1/3 here and no cover letter - what's going on with dependencies?

#2 lore raw
Quoted 8 lines · Mark Brown
Quoted 3 lines · Amadeusz Sławiński

If we don't find any pcm, pcm will point at address at an offset from the the list head and not a meaningful structure. Fix this by returning correct pcm if found and NULL if not. Found with coccinelle.

I only have patch 1/3 here and no cover letter - what's going on with dependencies?

Oops, I'm sorry about this. There is only this patch, do you want me to resend?

maintainer
#3 lore raw
Quoted 2 lines · Amadeusz Sławiński

Oops, I'm sorry about this. There is only this patch, do you want me to resend?

No, it's OK.

maintainer
#4 lore raw

Applied "ASoC: codecs: hdac_hdmi: Fix incorrect use of list_for_each_entry" to the asoc tree

In reply to Amadeusz Sławiński

The patch

ASoC: codecs: hdac_hdmi: Fix incorrect use of list_for_each_entry

has been applied to the asoc tree at

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

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

From 326b509238171d37402dbe308e154cc234ed1960 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?=
<[email protected]>
Date: Wed, 15 Apr 2020 12:28:49 -0400
Subject: [PATCH] ASoC: codecs: hdac_hdmi: Fix incorrect use of
list_for_each_entry
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If we don't find any pcm, pcm will point at address at an offset from the the list head and not a meaningful structure. Fix this by returning correct pcm if found and NULL if not. Found with coccinelle.

---
 sound/soc/codecs/hdac_hdmi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/hdac_hdmi.c +3 -3
index fba9b749839d..f26b77faed59 100644
@@ -142,14 +142,14 @@ static struct hdac_hdmi_pcm *
 hdac_hdmi_get_pcm_from_cvt(struct hdac_hdmi_priv *hdmi,
 			   struct hdac_hdmi_cvt *cvt)
 {
-	struct hdac_hdmi_pcm *pcm = NULL;
+	struct hdac_hdmi_pcm *pcm;
 
 	list_for_each_entry(pcm, &hdmi->pcm_list, head) {
 		if (pcm->cvt == cvt)
-			break;
+			return pcm;
 	}
 
-	return pcm;
+	return NULL;
 }
 
 static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
Signature · 1 line
2.20.1