alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ALSA: control - add the missing prev_lops2 initialization
@ 2021-03-31 18:07 Jaroslav Kysela
  2021-04-01  8:06 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Jaroslav Kysela @ 2021-03-31 18:07 UTC (permalink / raw)
  To: ALSA development; +Cc: Takashi Iwai

As static analysis reported, the prev_lops2 should contain
the previous lops2 pointer in snd_ctl_disconnect_layer().

Link: https://lore.kernel.org/alsa-devel/96e9bd5c-c8db-0db8-b393-fbf4a047dc80@canonical.com/
Fixes: 3f0638a0333b ("ALSA: control - add layer registration routines")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 sound/core/control.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/core/control.c b/sound/core/control.c
index 6825ca75daf5..20d707d4ef40 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -2074,7 +2074,7 @@ void snd_ctl_disconnect_layer(struct snd_ctl_layer_ops *lops)
 	struct snd_ctl_layer_ops *lops2, *prev_lops2;
 
 	down_write(&snd_ctl_layer_rwsem);
-	for (lops2 = snd_ctl_layer, prev_lops2 = NULL; lops2; lops2 = lops2->next)
+	for (lops2 = snd_ctl_layer, prev_lops2 = NULL; lops2; lops2 = lops2->next) {
 		if (lops2 == lops) {
 			if (!prev_lops2)
 				snd_ctl_layer = lops->next;
@@ -2082,6 +2082,8 @@ void snd_ctl_disconnect_layer(struct snd_ctl_layer_ops *lops)
 				prev_lops2->next = lops->next;
 			break;
 		}
+		prev_lops2 = lops2;
+	}
 	up_write(&snd_ctl_layer_rwsem);
 }
 EXPORT_SYMBOL_GPL(snd_ctl_disconnect_layer);
-- 
2.30.2

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

* Re: [PATCH] ALSA: control - add the missing prev_lops2 initialization
  2021-03-31 18:07 [PATCH] ALSA: control - add the missing prev_lops2 initialization Jaroslav Kysela
@ 2021-04-01  8:06 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-04-01  8:06 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: ALSA development

On Wed, 31 Mar 2021 20:07:02 +0200,
Jaroslav Kysela wrote:
> 
> As static analysis reported, the prev_lops2 should contain
> the previous lops2 pointer in snd_ctl_disconnect_layer().
> 
> Link: https://lore.kernel.org/alsa-devel/96e9bd5c-c8db-0db8-b393-fbf4a047dc80@canonical.com/
> Fixes: 3f0638a0333b ("ALSA: control - add layer registration routines")
> Signed-off-by: Jaroslav Kysela <perex@perex.cz>

Applied, thanks.


Takashi

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

end of thread, other threads:[~2021-04-01  8:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31 18:07 [PATCH] ALSA: control - add the missing prev_lops2 initialization Jaroslav Kysela
2021-04-01  8:06 ` Takashi Iwai

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).