Skip to contentSkip to conversation

sym53c8xx: Read buffer overflow

PATCH In review Roel Kluin 2 participants 2 messages Aug 9, 2009

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 sym53c8xx: Read buffer overflow

Prevent read from div_10M[-1] when no clock divisor was greater.

---
Can this happen?

drivers/scsi/sym53c8xx_2/sym_hipd.c +3 -0
index 297deb8..230add3 100644
@@ -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.
maintainer
#1 lore raw
Quoted 5 lines · Roel Kluin

Prevent read from div_10M[-1] when no clock divisor was greater.

---
Can this happen?

No: The low values are only possible for lower periods. 125 is the min period this chip would ever accept (u160) and in order to support that it has to have a master clock at 160MHz.

James