sym53c8xx_2: iterator underflow in sym_getsync()
PATCH 1/1 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 <[email protected]>
drivers/scsi/sym53c8xx_2/sym_hipd.c +1 -1
@@ -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 ;/*
Looks good,
Reviewed-by Johannes Thumshirn <[email protected]>
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Martin K. Petersen
AppliedDan,
Quoted 3 lines
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.
Applied to 4.16/scsi-fixes, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering