sanitizer_common: Fix warning
authorMatthias Braun <matze@braunis.de>
Tue, 16 Aug 2016 18:28:55 +0000 (18:28 +0000)
committerMatthias Braun <matze@braunis.de>
Tue, 16 Aug 2016 18:28:55 +0000 (18:28 +0000)
Clang added warning that taking the address of a packed struct member
possibly yields an unaligned pointer. This case is benign because
the pointer gets casted to an uptr and not used for unaligned accesses.
Add an intermediate cast to char* until this warning is improved (see
also https://reviews.llvm.org/D20561)

llvm-svn: 278835

compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc

index 959c622..4ed9afe 100644 (file)
@@ -583,7 +583,8 @@ static void ioctl_common_pre(void *ctx, const ioctl_desc *desc, int d,
     return;
   if (request == IOCTL_SIOCGIFCONF) {
     struct __sanitizer_ifconf *ifc = (__sanitizer_ifconf *)arg;
-    COMMON_INTERCEPTOR_READ_RANGE(ctx, &ifc->ifc_len, sizeof(ifc->ifc_len));
+    COMMON_INTERCEPTOR_READ_RANGE(ctx, (char*)&ifc->ifc_len,
+                                  sizeof(ifc->ifc_len));
   }
 }