Skip to contentSkip to conversation

ALSA: hda - Pass printf argument directly to request_module()

PATCH New Takashi Iwai 1 participant 1 message Oct 27, 2014 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda - Pass printf argument directly to request_module()

request_module() handles the printf style arguments, so we don't have to render strings in the caller side. Not only it reduces the unnecessary temporary string buffer, it's even safer from the security POV.

---
 sound/pci/hda/hda_codec.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
sound/pci/hda/hda_codec.c +4 -6
index 259fbeaa37bd..0025bf4c2f44 100644
@@ -966,14 +966,12 @@ find_codec_preset(struct hda_codec *codec)
 	mutex_unlock(&preset_mutex);
 
 	if (mod_requested < HDA_MODREQ_MAX_COUNT) {
-		char name[32];
 		if (!mod_requested)
-			snprintf(name, sizeof(name), "snd-hda-codec-id:%08x",
-				 codec->vendor_id);
+			request_module("snd-hda-codec-id:%08x",
+				       codec->vendor_id);
 		else
-			snprintf(name, sizeof(name), "snd-hda-codec-id:%04x*",
-				 (codec->vendor_id >> 16) & 0xffff);
-		request_module(name);
+			request_module("snd-hda-codec-id:%04x*",
+				       (codec->vendor_id >> 16) & 0xffff);
 		mod_requested++;
 		goto again;
 	}
Signature · 1 line
2.1.2