ALSA: hdsp - Fix potential Oops in snd_hdsp_info_pref_sync_ref()
authorTakashi Iwai <tiwai@suse.de>
Mon, 9 Jan 2012 17:22:35 +0000 (18:22 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 9 Jan 2012 17:27:44 +0000 (18:27 +0100)
Dan Carpenter reported that setting 0 to uinfo->value.enumerated.items
in snd_hdsp_info_pref_sync_ref() may lead to Oops.  This function should
return an error immediately in such a case instead.

Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/rme9652/hdsp.c

index 0111203859b6f6877609a40e4f47184e2a0d8d03..b68cdec03b9e02ebf122d06c4f93ed4aea752961 100644 (file)
@@ -2640,8 +2640,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd
                uinfo->value.enumerated.items = 3;
                break;
        default:
-               uinfo->value.enumerated.items = 0;
-               break;
+               return -EINVAL;
        }
 
        if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)