aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2013-01-07 22:03:51 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-17 08:44:09 -0800
commit71a1306551e811989c0164c614845fea352d8b57 (patch)
tree3c523c008467f9cf210a6b23e0bfa70b1db8d0f2 /drivers/staging
parent36aa8707613d57452ebfda30812e8715f019c453 (diff)
downloadkernel_samsung_smdk4412-71a1306551e811989c0164c614845fea352d8b57.zip
kernel_samsung_smdk4412-71a1306551e811989c0164c614845fea352d8b57.tar.gz
kernel_samsung_smdk4412-71a1306551e811989c0164c614845fea352d8b57.tar.bz2
staging: speakup: avoid out-of-range access in synth_add()
commit 6102c48bd421074a33e102f2ebda3724e8d275f9 upstream. Check that array index is in-bounds before accessing the synths[] array. Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Cc: Nickolai Zeldovich <nickolai@csail.mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/speakup/synth.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index b568803..7843111 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)
int i;
int status = 0;
mutex_lock(&spk_mutex);
- for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++)
+ for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
/* synth_remove() is responsible for rotating the array down */
if (in_synth == synths[i]) {
mutex_unlock(&spk_mutex);