about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-09-26 10:00:51 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-04-17 16:12:41 -0300
commit1eed82b6917bfd26e642b6eaf831d08595cf9cfb (patch)
tree0e32be5767e346e93aa0b85f3a9ea208fc46ba27
parentf85b9dde83b9de846e4417608a3276d591538eb5 (diff)
downloadglibc-1eed82b6917bfd26e642b6eaf831d08595cf9cfb.tar.gz
glibc-1eed82b6917bfd26e642b6eaf831d08595cf9cfb.tar.xz
glibc-1eed82b6917bfd26e642b6eaf831d08595cf9cfb.zip
linux: Avoid indirection on operand of type 'void *' for gettimeofday
ISO C does not allow and it fixes a clang issue with
-Werror,-Wvoid-ptr-dereference.

Checked on x86_64-linux-gnu.
-rw-r--r--sysdeps/unix/sysv/linux/gettimeofday.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/unix/sysv/linux/gettimeofday.c b/sysdeps/unix/sysv/linux/gettimeofday.c
index 7ab147c614..11d6173ff1 100644
--- a/sysdeps/unix/sysv/linux/gettimeofday.c
+++ b/sysdeps/unix/sysv/linux/gettimeofday.c
@@ -32,7 +32,7 @@ static int
 __gettimeofday_syscall (struct timeval *restrict tv, void *restrict tz)
 {
   if (__glibc_unlikely (tz != 0))
-    memset (tz, 0, sizeof *tz);
+    memset (tz, 0, sizeof (struct timezone));
   return INLINE_SYSCALL_CALL (gettimeofday, tv, tz);
 }
 
@@ -48,7 +48,7 @@ int
 __gettimeofday (struct timeval *restrict tv, void *restrict tz)
 {
   if (__glibc_unlikely (tz != 0))
-    memset (tz, 0, sizeof *tz);
+    memset (tz, 0, sizeof (struct timezone));
 
   return INLINE_VSYSCALL (gettimeofday, 2, tv, tz);
 }