[alsa-devel] [PATCH] pas2: Added a fix where a sound card failure should not result in reading beyond array memory index.
Takashi Iwai
tiwai at suse.de
Thu Jan 3 10:26:09 CET 2013
At Fri, 28 Dec 2012 12:28:57 -0600,
Asim Kadav wrote:
>
> Signed-off-by: Asim Kadav <kadav at cs.wisc.edu>
> ---
> sound/oss/pas2_card.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/sound/oss/pas2_card.c b/sound/oss/pas2_card.c
> index dabf8a8..0b8cf64 100644
> --- a/sound/oss/pas2_card.c
> +++ b/sound/oss/pas2_card.c
> @@ -332,6 +332,10 @@ static void __init attach_pas_card(struct address_info *hw_config)
> if ((pas_model = pas_read(0xFF88)))
> {
> char temp[100];
> + if ((int )pas_model < 0 || (int )pas_model >= 5) {
Try to run scripts/checkpatch.pl. You'll get a few errors there.
But, you can simply remove the cast to int instead of fixing the
coding style issues since the cast is superfluous.
Also, use ARRAY_SIZE() instead of a magic number 5.
> + printk ("pas2card unrecognized model.\n");
Put a KERN_ERR prefix.
thanks,
Takashi
> + return;
> + }
>
> sprintf(temp,
> "%s rev %d", pas_model_names[(int) pas_model],
> --
> 1.7.11.3
More information about the Alsa-devel
mailing list