Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: tiwai@suse.com, linux-sound@vger.kernel.org, broonie@kernel.org,
	perex@perex.cz, amadeuszx.slawinski@linux.intel.com
Subject: Re: [PATCH 3/3] ALSA: control: Fix argument type mismatch
Date: Thu, 09 Jan 2025 15:31:35 +0100	[thread overview]
Message-ID: <87wmf45a9k.wl-tiwai@suse.de> (raw)
In-Reply-To: <20250109125204.3668961-4-cezary.rojewski@intel.com>

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@intel.com>

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.


thanks,

Takashi

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

  reply	other threads:[~2025-01-09 14:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 12:52 [PATCH 0/3] ALSA: hda: Compilation and firmware-loading fixes Cezary Rojewski
2025-01-09 12:52 ` [PATCH 1/3] ALSA: hda: Fix compilation of snd_hdac_adsp_xxx() helpers Cezary Rojewski
2025-01-09 12:42   ` Jaroslav Kysela
2025-01-09 14:20     ` Takashi Iwai
2025-01-09 14:41       ` Cezary Rojewski
2025-01-09 14:52         ` Takashi Iwai
2025-01-09 12:52 ` [PATCH 2/3] ALSA: hda: Transfer firmware in two chunks Cezary Rojewski
2025-01-09 14:29   ` Takashi Iwai
2025-01-09 17:13     ` Cezary Rojewski
2025-01-09 12:52 ` [PATCH 3/3] ALSA: control: Fix argument type mismatch Cezary Rojewski
2025-01-09 14:31   ` Takashi Iwai [this message]
2025-01-09 14:47     ` Cezary Rojewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wmf45a9k.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox