Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Aug 2014 15:04:02 +0000 (UTC)
From:      Joerg Wunsch <joerg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r269722 - stable/8/sys/dev/usb/serial
Message-ID:  <53e4e6e2.2a2f.5ff767c5@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: joerg
Date: Fri Aug  8 15:04:02 2014
New Revision: 269722
URL: http://svnweb.freebsd.org/changeset/base/269722

Log:
  MFC r269470: avoid divide-by-zero panic when setting baudrate to 0.

Modified:
  stable/8/sys/dev/usb/serial/umcs.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/usb/   (props changed)

Modified: stable/8/sys/dev/usb/serial/umcs.c
==============================================================================
--- stable/8/sys/dev/usb/serial/umcs.c	Fri Aug  8 14:56:04 2014	(r269721)
+++ stable/8/sys/dev/usb/serial/umcs.c	Fri Aug  8 15:04:02 2014	(r269722)
@@ -1059,7 +1059,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53e4e6e2.2a2f.5ff767c5>