From: Roel Kluin <roel.kluin@gmail.com>
To: Matthew Wilcox <matthew@wil.cx>,
linux-scsi@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] sym53c8xx: Read buffer overflow
Date: Sun, 09 Aug 2009 16:16:47 +0200 [thread overview]
Message-ID: <4A7EDA4F.6080402@gmail.com> (raw)
Prevent read from div_10M[-1] when no clock divisor was greater.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Can this happen?
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 297deb8..230add3 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -542,6 +542,9 @@ sym_getsync(struct sym_hcb *np, u_char dt, u_char sfac, u_char *divp, u_char *fa
while (div-- > 0)
if (kpc >= (div_10M[div] << 2)) break;
+ if (div < 0)
+ return -1;
+
/*
* Calculate the lowest clock factor that allows an output
* speed not faster than the period, and the max output speed.
next reply other threads:[~2009-08-09 14:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-09 14:16 Roel Kluin [this message]
2009-08-09 14:37 ` [PATCH] sym53c8xx: Read buffer overflow James Bottomley
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=4A7EDA4F.6080402@gmail.com \
--to=roel.kluin@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew@wil.cx \
/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