svn commit: r269721 - stable/9/sys/dev/usb/serial
Joerg Wunsch
joerg at FreeBSD.org
Fri Aug 8 14:56:04 UTC 2014
Author: joerg
Date: Fri Aug 8 14:56:04 2014
New Revision: 269721
URL: http://svnweb.freebsd.org/changeset/base/269721
Log:
MFC r269470: Avoid divide-by-zero panic when setting baudrate to 0.
Modified:
stable/9/sys/dev/usb/serial/umcs.c
Directory Properties:
stable/9/sys/ (props changed)
stable/9/sys/dev/ (props changed)
Modified: stable/9/sys/dev/usb/serial/umcs.c
==============================================================================
--- stable/9/sys/dev/usb/serial/umcs.c Fri Aug 8 14:53:01 2014 (r269720)
+++ stable/9/sys/dev/usb/serial/umcs.c Fri Aug 8 14:56:04 2014 (r269721)
@@ -1083,7 +1083,10 @@ umcs7840_calc_baudrate(uint32_t rate, ui
for (i = 0; i < umcs7840_baudrate_divisors_len - 1 &&
!(rate > umcs7840_baudrate_divisors[i] && rate <= umcs7840_baudrate_divisors[i + 1]); ++i);
- *divisor = umcs7840_baudrate_divisors[i + 1] / rate;
+ if (rate == 0)
+ *divisor = 1; /* XXX */
+ else
+ *divisor = umcs7840_baudrate_divisors[i + 1] / rate;
/* 0x00 .. 0x70 */
*clk = i << MCS7840_DEV_SPx_CLOCK_SHIFT;
return (0);
More information about the svn-src-stable-9
mailing list