Re: [PATCH] sound, hda_eld: suspicious sizeof() in call to snd_print_pcm_bits()

From: Takashi Iwai
Date: Sat Jan 29 2011 - 06:02:17 EST


At Sat, 29 Jan 2011 01:40:04 +0100 (CET),
Jesper Juhl wrote:
>
> In hdmi_show_short_audio_desc() we call snd_print_pcm_bits() like this:
> snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2 - 8));
> that last argument is supposed to be the size of the buffer that
> snd_print_pcm_bits() writes to, so I believe it should be this:
> snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8);
>
> Signed-off-by: Jesper Juhl <jj@xxxxxxxxxxxxx>

Thanks, but this was already fixed in sound git tree and included in
the pending pull request for 2.6.38.


Takashi

> ---
> hda_eld.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Compile tested only. I don't have relevant hardware.
>
> diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
> index 4a66347..74b0560 100644
> --- a/sound/pci/hda/hda_eld.c
> +++ b/sound/pci/hda/hda_eld.c
> @@ -381,7 +381,7 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a)
> snd_print_pcm_rates(a->rates, buf, sizeof(buf));
>
> if (a->format == AUDIO_CODING_TYPE_LPCM)
> - snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2 - 8));
> + snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8);
> else if (a->max_bitrate)
> snprintf(buf2, sizeof(buf2),
> ", max bitrate = %d", a->max_bitrate);
>
>
> --
> Jesper Juhl <jj@xxxxxxxxxxxxx> http://www.chaosbits.net/
> Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
> Plain text mails only, please.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/