summary refs log tree commit diff
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2022-09-01 15:09:12 +0200
committerTakashi Iwai <tiwai@suse.de>2022-09-01 15:09:12 +0200
commit041af76890ba66f6222dd910807fe0b170109e7d (patch)
treefb2a4ea4b38544b843da103c1273127ef9969edd /sound/core
parentf51ba1148a810a16eead9f0b29bfa2a8f8ab3afb (diff)
parentff878b408a03bef5d610b7e2302702e16a53636e (diff)
downloadlinux-041af76890ba66f6222dd910807fe0b170109e7d.tar.gz
Merge branch 'for-linus' into for-next
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/control.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/core/control.c b/sound/core/control.c
index f3e893715369..a7271927d875 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -385,14 +385,14 @@ static bool elem_id_matches(const struct snd_kcontrol *kctl,
 #define MULTIPLIER	37
 static unsigned long get_ctl_id_hash(const struct snd_ctl_elem_id *id)
 {
+	int i;
 	unsigned long h;
-	const unsigned char *p;
 
 	h = id->iface;
 	h = MULTIPLIER * h + id->device;
 	h = MULTIPLIER * h + id->subdevice;
-	for (p = id->name; *p; p++)
-		h = MULTIPLIER * h + *p;
+	for (i = 0; i < SNDRV_CTL_ELEM_ID_NAME_MAXLEN && id->name[i]; i++)
+		h = MULTIPLIER * h + id->name[i];
 	h = MULTIPLIER * h + id->index;
 	h &= LONG_MAX;
 	return h;