Commit f7b2bb85 authored by Dan Carpenter's avatar Dan Carpenter Committed by Takashi Iwai

ALSA: hwdep: silence integer overflow warning

Smatch complains that if device is INT_MAX then device + 1 can
overflow.  It just means we would have an annoying loop while we
check all the devices from -2147483648 to SNDRV_MINOR_HWDEPS.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8128c9f2
...@@ -272,7 +272,14 @@ static int snd_hwdep_control_ioctl(struct snd_card *card, ...@@ -272,7 +272,14 @@ static int snd_hwdep_control_ioctl(struct snd_card *card,
if (get_user(device, (int __user *)arg)) if (get_user(device, (int __user *)arg))
return -EFAULT; return -EFAULT;
mutex_lock(&register_mutex); mutex_lock(&register_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) { while (device < SNDRV_MINOR_HWDEPS) {
if (snd_hwdep_search(card, device)) if (snd_hwdep_search(card, device))
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment