Skip to contentSkip to conversation

USB: cxacru: potential underflow in cxacru_cm_get_array()

PATCH New Dan Carpenter 1 participant 1 message May 19, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: cxacru: potential underflow in cxacru_cm_get_array()

The value of "offd" comes off the instance->rcv_buf[] and we used it as the offset into an array. The problem is that we check the upper bound but not for negative values.

drivers/usb/atm/cxacru.c +2 -1
index b7eb86a..8a7eb77 100644
@@ -686,7 +686,8 @@ static int cxacru_cm_get_array(struct cxacru_data *instance, enum cxacru_cm_requ
 {
 	int ret, len;
 	__le32 *buf;
-	int offb, offd;
+	int offb;
+	unsigned int offd;
 	const int stride = CMD_PACKET_SIZE / (4 * 2) - 1;
 	int buflen =  ((size - 1) / stride + 1 + size * 2) * 4;