From: Samuel Thibault <samuel.thibault@ens-lyon.org>
To: Nickolai Zeldovich <nickolai@csail.mit.edu>, gregkh@linuxfoundation.org
Cc: William Hubbs <w.d.hubbs@gmail.com>,
Chris Brannon <chris@the-brannons.com>,
Kirk Reiser <kirk@braille.uwo.ca>,
linux-kernel@vger.kernel.org, speakup@braille.uwo.ca
Subject: Re: [PATCH] drivers/staging/speakup: avoid out-of-range access
Date: Sat, 5 Jan 2013 20:29:44 +0100 [thread overview]
Message-ID: <20130105192944.GL5965@type.youpi.perso.aquilenet.fr> (raw)
In-Reply-To: <1357413465-42357-1-git-send-email-nickolai@csail.mit.edu>
Indeed. The same happens in synth_add, so Greg please use this instead:
Check that array index is in-bounds before accessing the synths[] array.
Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
drivers/staging/speakup/synth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index df95337..b91d22b 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -342,7 +342,7 @@ int synth_init(char *synth_name)
mutex_lock(&spk_mutex);
/* First, check if we already have it loaded. */
- for (i = 0; synths[i] != NULL && i < MAXSYNTHS; i++)
+ for (i = 0; i < MAXSYNTHS && synths[i] != NULL; i++)
if (strcmp(synths[i]->name, synth_name) == 0)
synth = synths[i];
@@ -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);
next parent reply other threads:[~2013-01-05 19:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1357413465-42357-1-git-send-email-nickolai@csail.mit.edu>
2013-01-05 19:29 ` Samuel Thibault [this message]
2013-01-07 17:44 ` Greg KH
2013-01-07 21:03 ` Samuel Thibault
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130105192944.GL5965@type.youpi.perso.aquilenet.fr \
--to=samuel.thibault@ens-lyon.org \
--cc=chris@the-brannons.com \
--cc=gregkh@linuxfoundation.org \
--cc=kirk@braille.uwo.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=nickolai@csail.mit.edu \
--cc=speakup@braille.uwo.ca \
--cc=w.d.hubbs@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®