bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 5/6] Implement fallback for explicit_bzero using jump to volatile


From: roucaries . bastien
Subject: [PATCH 5/6] Implement fallback for explicit_bzero using jump to volatile pointer
Date: Mon, 13 Apr 2020 01:09:17 +0200

From: Bastien Roucari├Ęs <address@hidden>

Signed-off-by: Bastien Roucari├Ęs <address@hidden>
---
 lib/explicit_bzero.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
index bb52d11de..03968acbf 100644
--- a/lib/explicit_bzero.c
+++ b/lib/explicit_bzero.c
@@ -54,9 +54,8 @@ explicit_bzero (void *s, size_t len)
   explicit_memset (s, 0, len);
 #elif HAVE_MEMSET_S
   (void) memset_s (s, len, '\0', len);
-#else
+#elif defined __GNUC__
   memset (s, '\0', len);
-#if defined __GNUC__
 # if !defined __clang__
   /* Compiler barrier.  */
   asm volatile ("" ::: "memory");
@@ -64,5 +63,8 @@ explicit_bzero (void *s, size_t len)
    /* https://bugs.llvm.org/show_bug.cgi?id=15495#c11 */
   __asm__ volatile("" : : "g"(s) : "memory");
 # endif
+#else
+  static void * (* const volatile volatile_memset)(void *, int, size_t) = 
memset;
+  (void) volatile_memset1(s, '\0', len);
 #endif
 }
-- 
2.25.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]