Commit e6f791d9 authored by Dan Carpenter's avatar Dan Carpenter Committed by Martin K. Petersen

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Acked-by: default avatarMatthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent ecf7ff49
...@@ -536,7 +536,7 @@ sym_getsync(struct sym_hcb *np, u_char dt, u_char sfac, u_char *divp, u_char *fa ...@@ -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 * Look for the greatest clock divisor that allows an
* input speed faster than the period. * input speed faster than the period.
*/ */
while (div-- > 0) while (--div > 0)
if (kpc >= (div_10M[div] << 2)) break; if (kpc >= (div_10M[div] << 2)) break;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment