X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=sound%2Fcore%2Fhwdep.c;h=75ea16f35b1aa1e1db985802e923c86e28f69af3;hb=4a1dba72384193753e44e15d9d05a50be6587271;hp=a70ee7f1ed9832ed3ef3b4463376786dd2500234;hpb=d8312204768861d77ec868265b2c1a36a1bf078f;p=~andy%2Flinux diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index a70ee7f1ed9..75ea16f35b1 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -272,7 +273,14 @@ static int snd_hwdep_control_ioctl(struct snd_card *card, if (get_user(device, (int __user *)arg)) return -EFAULT; mutex_lock(®ister_mutex); - device = device < 0 ? 0 : device + 1; + + if (device < 0) + device = 0; + else if (device < SNDRV_MINOR_HWDEPS) + device++; + else + device = SNDRV_MINOR_HWDEPS; + while (device < SNDRV_MINOR_HWDEPS) { if (snd_hwdep_search(card, device)) break;