Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Arnd Bergmann and committed by
Mauro Carvalho Chehab
fe365285 b3120d2c

+3 -3
+3 -3
drivers/media/pci/ttpci/av7110.c
··· 347 347 static inline void print_time(char *s) 348 348 { 349 349 #ifdef DEBUG_TIMING 350 - struct timeval tv; 351 - do_gettimeofday(&tv); 352 - printk("%s: %d.%d\n", s, (int)tv.tv_sec, (int)tv.tv_usec); 350 + struct timespec64 ts; 351 + ktime_get_real_ts64(&ts); 352 + printk("%s: %lld.%09ld\n", s, (s64)ts.tv_sec, ts.tv_nsec); 353 353 #endif 354 354 } 355 355