mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-28 10:10:29 +00:00
Avoid division by zero in serial.
This commit is contained in:
1 parent
4816dcac19
commit
e95685dab1
3 files changed
+17
-1
No files matched your search
@@ -57,6 +57,8 @@ serial_get_divisor (const struct grub_serial_port *port __attribute__ ((unused))
|
||||
base_clock = config->base_clock ? (config->base_clock >> 4) : DEFAULT_BASE_CLOCK;
|
||||
|
||||
divisor = (base_clock + (config->speed / 2)) / config->speed;
|
||||
if (config->speed == 0)
|
||||
return 0;
|
||||
if (divisor > 0xffff || divisor == 0)
|
||||
return 0;
|
||||
actual_speed = base_clock / divisor;
|
||||
|
||||
Reference in new issue
Block a user