diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-01-07 16:03:51 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-07 16:53:28 -0500 |
commit | 6102c48bd421074a33e102f2ebda3724e8d275f9 (patch) | |
tree | 44f791324fb19dba052e5eb61efe5afe324af6bd /drivers | |
parent | ae428655b826f2755a8101b27beda42a275ef8ad (diff) |
staging: speakup: avoid out-of-range access in synth_add()
Check that array index is in-bounds before accessing the synths[] array.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: stable <stable@vger.kernel.org>
Cc: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/speakup/synth.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c index b91d22b6330f..7616f058a00b 100644 --- a/drivers/staging/speakup/synth.c +++ b/drivers/staging/speakup/synth.c | |||
@@ -423,7 +423,7 @@ int synth_add(struct spk_synth *in_synth) | |||
423 | int i; | 423 | int i; |
424 | int status = 0; | 424 | int status = 0; |
425 | mutex_lock(&spk_mutex); | 425 | mutex_lock(&spk_mutex); |
426 | for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++) | 426 | for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++) |
427 | /* synth_remove() is responsible for rotating the array down */ | 427 | /* synth_remove() is responsible for rotating the array down */ |
428 | if (in_synth == synths[i]) { | 428 | if (in_synth == synths[i]) { |
429 | mutex_unlock(&spk_mutex); | 429 | mutex_unlock(&spk_mutex); |