Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 28 Jun 2018 20:57:29 +0300
From: Alexander Monakov <amonakov@...ras.ru>
To: musl@...ts.openwall.com
Cc: Alexander Monakov <amonakov@...ras.ru>
Subject: [PATCH] optimize explicit_bzero for size

Avoid saving/restoring the incoming argument by reusing memset return value.
---

I think it's unfortunate that the commit adding explicit_bzero does not say
the rationale for the magic empty asm; LTO being the "obvious" explanation,
of course, IMHO is not a reason to omit the explanation. Does it imply an
intention to support LTO, and if so, would other magic asms elsewhere be
accepted if they help with LTO issues?

Alexander

 src/string/explicit_bzero.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/string/explicit_bzero.c b/src/string/explicit_bzero.c
index 3d270040..f2e12f23 100644
--- a/src/string/explicit_bzero.c
+++ b/src/string/explicit_bzero.c
@@ -3,6 +3,6 @@
 
 void explicit_bzero(void *d, size_t n)
 {
-	memset(d, 0, n);
+	d = memset(d, 0, n);
 	__asm__ __volatile__ ("" : : "r"(d) : "memory");
 }
-- 
2.11.0

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.