grub2/0164-rtc_get_time_ms.c-grub_rtc_get_time_ms-Avoid-divisio.patch
Peter Jones 8c6b1ac71e Reconcile with upstream once again.
Also include some minor fixes for gcc 5.1.1

Signed-off-by: Peter Jones <pjones@redhat.com>
2015-07-22 09:46:32 -04:00

41 lines
1.4 KiB
Diff

From 4e0a25a4c03b5e91396912393d5db9871d45bde8 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Tue, 20 Jan 2015 21:10:55 +0100
Subject: [PATCH 164/506] rtc_get_time_ms.c (grub_rtc_get_time_ms): Avoid
division by zero.
---
ChangeLog | 5 +++++
grub-core/kern/generic/rtc_get_time_ms.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 0376974..40ced5a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+ * grub-core/kern/generic/rtc_get_time_ms.c (grub_rtc_get_time_ms): Avoid
+ division by zero.
+
+2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/loader/i386/xnu.c (guessfsb): Avoid division by 0.
2015-01-20 Vladimir Serbinenko <phcoder@gmail.com>
diff --git a/grub-core/kern/generic/rtc_get_time_ms.c b/grub-core/kern/generic/rtc_get_time_ms.c
index 49f2aca..3e39c8f 100644
--- a/grub-core/kern/generic/rtc_get_time_ms.c
+++ b/grub-core/kern/generic/rtc_get_time_ms.c
@@ -34,5 +34,5 @@ grub_rtc_get_time_ms (void)
1 s 1 T rtc ticks
*/
grub_uint64_t ticks_ms_per_sec = ((grub_uint64_t) 1000) * grub_get_rtc ();
- return grub_divmod64 (ticks_ms_per_sec, GRUB_TICKS_PER_SECOND, 0);
+ return grub_divmod64 (ticks_ms_per_sec, GRUB_TICKS_PER_SECOND ? : 1000, 0);
}
--
2.4.3