• Randy Dunlap's avatar
    [PATCH] tiglusb timeouts · 19cd163c
    Randy Dunlap authored
    It addresses the timeout parameter in the tiglusb driver.
    
    1.  timeout could be 0, causing a divide-by-zero.
    The patch prevents this.
    
    2.  The timeout value to usb_bulk_msg() could be rounded
    down to cause a divide-by-zero if timeout was < 10, e.g. 9,
    in:
    	result = usb_bulk_msg (s->dev, pipe, buffer, bytes_to_read,
    			       &bytes_read, HZ / (timeout / 10));
    9 / 10 == 0 => divide-by-zero !!
    
    3.  The timeout value above doesn't do very well on converting
    timeout to tenths of seconds.  Even for the default timeout
    value of 15 (1.5 seconds), it becomes:
    	HZ / (15 / 10) == HZ / 1 == HZ, or 1 second.
    The patch corrects this formula to use:
    	(HZ * 10) / timeout
    19cd163c
tiglusb.c 11.3 KB