Skip to contentSkip to conversation

media: av7110: avoid 2038 overflow in debug print

PATCH New Arnd Bergmann 1 participant 1 message Nov 6, 2017 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: av7110: avoid 2038 overflow in debug print

Using the deprecated do_gettimeofday() in print_time() will overflow in 2038 on 32-bit architectures. It'sbetter to use a structure that is safe everywhere. While we're at it, fix the missing leading zeroes on the sub-second portion.

---
 drivers/media/pci/ttpci/av7110.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/pci/ttpci/av7110.c +3 -3
index f89fb23f6c57..6d415bdeef18 100644
@@ -347,9 +347,9 @@ static int DvbDmxFilterCallback(u8 *buffer1, size_t buffer1_len,
 static inline void print_time(char *s)
 {
 #ifdef DEBUG_TIMING
-	struct timeval tv;
-	do_gettimeofday(&tv);
-	printk("%s: %d.%d\n", s, (int)tv.tv_sec, (int)tv.tv_usec);
+	struct timespec64 ts;
+	ktime_get_real_ts64(&ts);
+	printk("%s: %lld.%09ld\n", s, (s64)ts.tv_sec, ts.tv_nsec);
 #endif
 }
 
Signature · 1 line
2.9.0