[compiler-rt] r278835 - sanitizer_common: Fix warning

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 16 11:28:56 PDT 2016


Author: matze
Date: Tue Aug 16 13:28:55 2016
New Revision: 278835

URL: http://llvm.org/viewvc/llvm-project?rev=278835&view=rev
Log:
sanitizer_common: Fix warning

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)

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc?rev=278835&r1=278834&r2=278835&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc Tue Aug 16 13:28:55 2016
@@ -583,7 +583,8 @@ static void ioctl_common_pre(void *ctx,
     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));
   }
 }
 




More information about the llvm-commits mailing list