summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/sym53c8xx_2
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-01-25 15:13:40 +0100
committerMartin K. Petersen <martin.petersen@oracle.com>2018-01-31 03:29:16 +0100
commite6f791d95313c85f3dd4a26141e28e50ae9aa0ae (patch)
treebae7079b67c091e2f260e71c7c7c2781d3159982 /drivers/scsi/sym53c8xx_2
parentscsi: bnx2fc: Fix check in SCSI completion handler for timed out request (diff)
downloadlinux-e6f791d95313c85f3dd4a26141e28e50ae9aa0ae.tar.xz
linux-e6f791d95313c85f3dd4a26141e28e50ae9aa0ae.zip
scsi: sym53c8xx_2: iterator underflow in sym_getsync()
We wanted to exit the loop with "div" set to zero, but instead, if we don't hit the break then "div" is -1 when we finish the loop. It leads to an array underflow a few lines later. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Acked-by: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/sym53c8xx_2')
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index ca360daa6a25..378af306fda1 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -536,7 +536,7 @@ sym_getsync(struct sym_hcb *np, u_char dt, u_char sfac, u_char *divp, u_char *fa
* Look for the greatest clock divisor that allows an
* input speed faster than the period.
*/
- while (div-- > 0)
+ while (--div > 0)
if (kpc >= (div_10M[div] << 2)) break;
/*