[ALSA] sound/core/: fix 3 off-by-one errors
Modules: ALSA Core This patch fixes three off-by-one errors found by the Coverity checker. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Цей коміт міститься в:

зафіксовано
Jaroslav Kysela

джерело
646494007b
коміт
3a63e44420
@@ -121,7 +121,7 @@ void *snd_lookup_minor_data(unsigned int minor, int type)
|
||||
struct snd_minor *mreg;
|
||||
void *private_data;
|
||||
|
||||
if (minor > ARRAY_SIZE(snd_minors))
|
||||
if (minor >= ARRAY_SIZE(snd_minors))
|
||||
return NULL;
|
||||
mutex_lock(&sound_mutex);
|
||||
mreg = snd_minors[minor];
|
||||
@@ -140,7 +140,7 @@ static int snd_open(struct inode *inode, struct file *file)
|
||||
struct file_operations *old_fops;
|
||||
int err = 0;
|
||||
|
||||
if (minor > ARRAY_SIZE(snd_minors))
|
||||
if (minor >= ARRAY_SIZE(snd_minors))
|
||||
return -ENODEV;
|
||||
mptr = snd_minors[minor];
|
||||
if (mptr == NULL) {
|
||||
|
Посилання в новій задачі
Заблокувати користувача