summaryrefslogtreecommitdiff
path: root/lib/string.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2015-01-06 00:27:45 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2015-01-08 21:46:19 +1100
commit8155330aad477c5b1337895a6922df76817f0874 (patch)
treec71de980f54183c5472fe62357b6276c56d3152a /lib/string.c
parentad511e260a27b8e35d273cc0ecfe5a8ff9543181 (diff)
lib: memzero_explicit: add comment for its usage
Lets improve the comment to add a note on when to use memzero_explicit() for those not digging through the git logs. We don't want people to pollute places with memzero_explicit() where it's not really necessary. Reference: https://lkml.org/lkml/2015/1/4/190 Suggested-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'lib/string.c')
-rw-r--r--lib/string.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/string.c b/lib/string.c
index 10063300b830..d984ec4fd3b7 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -604,6 +604,11 @@ EXPORT_SYMBOL(memset);
* @s: Pointer to the start of the area.
* @count: The size of the area.
*
+ * Note: usually using memset() is just fine (!), but in cases
+ * where clearing out _local_ data at the end of a scope is
+ * necessary, memzero_explicit() should be used instead in
+ * order to prevent the compiler from optimising away zeroing.
+ *
* memzero_explicit() doesn't need an arch-specific version as
* it just invokes the one of memset() implicitly.
*/