Re: [PATCH 3/3] ALSA: control: Fix argument type mismatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]





On 2025-01-09 3:31 PM, Takashi Iwai wrote:
On Thu, 09 Jan 2025 13:52:04 +0100,
Cezary Rojewski wrote:

strscpy() expects argument of type "char *", not "unsigned char *".
Found out by Coverity static analyzer.

Fixes: 68fa05d4a82b ("ALSA: control: Introduce snd_ctl_find_id_mixer()")
Signed-off-by: Cezary Rojewski <cezary.rojewski@xxxxxxxxx>

The conversion between char and unsigned char pointers isn't taken
seriously in the kernel code.  The compiler warning was disabled
intentionally, too.  In general, such an unnecessary cast is more
harmful.

Understood, will remove in v2 and squelch the analyzers on the intel side.

---
  include/sound/control.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/sound/control.h b/include/sound/control.h
index e07f6b960641..f7e18a1d144f 100644
--- a/include/sound/control.h
+++ b/include/sound/control.h
@@ -161,7 +161,7 @@ snd_ctl_find_id_mixer(struct snd_card *card, const char *name)
  	struct snd_ctl_elem_id id = {};
id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
-	strscpy(id.name, name, sizeof(id.name));
+	strscpy((char *)id.name, name, sizeof(id.name));
  	return snd_ctl_find_id(card, &id);
  }
--
2.25.1






[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux