Skip to contentSkip to conversation

Staging: rtl8712: signedness bug in init

PATCH In review Dan Carpenter 2 participants 3 messages Nov 12, 2010

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

PATCH 1/1 Staging: rtl8712: signedness bug in init

PollingCnt is 20 and that means we loop 20 times and then run the timeout code. After the end of the loop PollingCnt should be -1 but because it's an unsigned char, it's actually 255 and the timeout code never runs.

drivers/staging/rtl8712/usb_halinit.c +1 -1
index f6569dc..0e9483b 100644
@@ -37,7 +37,7 @@ u8 r8712_usb_hal_bus_init(struct _adapter *padapter)
 {
 	u8 val8 = 0;
 	u8 ret = _SUCCESS;
-	u8 PollingCnt = 20;
+	int PollingCnt = 20;
 	struct registry_priv *pregistrypriv = &padapter->registrypriv;
 
 	if (pregistrypriv->chip_version = RTL8712_FPGA) {
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Dan Carpenter

PollingCnt is 20 and that means we loop 20 times and then run the timeout code. After the end of the loop PollingCnt should be -1 but because it's an unsigned char, it's actually 255 and the timeout code never runs.

As a point of interest, did you actually hit a timeout, or was this found by a code audit?

Larry

#2 lore raw
In reply to Dan Carpenter
Quoted 6 lines · Larry Finger
Quoted 5 lines · Dan Carpenter

PollingCnt is 20 and that means we loop 20 times and then run the timeout code. After the end of the loop PollingCnt should be -1 but because it's an unsigned char, it's actually 255 and the timeout code never runs.

Quoted 6 lines
Quoted 1 line

As a point of interest, did you actually hit a timeout, or was this found by a code audit?

This was a static check thing. (http://smatch.sf.net)

regards,
dan carpenter