Skip to contentSkip to conversation

ALSA: ump: Use safe_append_string() in snd_ump_update_group_attrs()

PATCH In review Thorsten Blum 2 participants 2 messages Oct 22 – Oct 23 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: ump: Use safe_append_string() in snd_ump_update_group_attrs()

To prepare for removing strlcat() from the kernel [1], use the existing safe_append_string() helper to append the group name separator.

No functional change.

---
 sound/core/ump.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
sound/core/ump.c +3 -1
index 3d1a2ed3b476..18780dece1a8 100644
@@ -559,6 +559,7 @@ static void snd_ump_proc_read(struct snd_info_entry *entry,
 /* update dir_bits and active flag for all groups in the client */
 void snd_ump_update_group_attrs(struct snd_ump_endpoint *ump)
 {
+	static const char separator[] = ", ";
 	struct snd_ump_block *fb;
 	struct snd_ump_group *group;
 	int i;
@@ -598,7 +599,8 @@ void snd_ump_update_group_attrs(struct snd_ump_endpoint *ump)
 			if (!*fb->info.name)
 				continue;
 			if (*group->name)
-				strlcat(group->name, ", ", sizeof(group->name));
+				safe_append_string(group->name, sizeof(group->name),
+						   separator, sizeof(separator));
 			safe_append_string(group->name, sizeof(group->name),
 					   fb->info.name, sizeof(fb->info.name));
 		}