sound: oss/pas2: Fix possible access out of array
authorAsim Kadav <kadav@cs.wisc.edu>
Thu, 3 Jan 2013 17:47:26 +0000 (11:47 -0600)
committerTakashi Iwai <tiwai@suse.de>
Fri, 4 Jan 2013 09:38:27 +0000 (10:38 +0100)
Added a fix for hardware dependence bug where a sound card failure
should not result in reading beyond array memory index.

Signed-off-by: Asim Kadav <kadav@cs.wisc.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/oss/pas2_card.c

index dabf8a871dcc26b75166712e3ee109136f7babd6..7004e24d209f167c196e231ffc1f883033eb8d54 100644 (file)
@@ -333,6 +333,11 @@ static void __init attach_pas_card(struct address_info *hw_config)
                {
                        char            temp[100];
 
+                       if (pas_model < 0 ||
+                           pas_model >= ARRAY_SIZE(pas_model_names)) {
+                               printk(KERN_ERR "pas2 unrecognized model.\n");
+                               return;
+                       }
                        sprintf(temp,
                            "%s rev %d", pas_model_names[(int) pas_model],
                                    pas_read(0x2789));