diff options
| author | Takashi Iwai <tiwai@suse.de> | 2019-11-25 14:27:33 +0100 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2019-11-25 14:27:41 +0100 |
| commit | 09578eacaaa44149738267083ccc050990409f86 (patch) | |
| tree | cf614ee065fe5479e4638abebe12c9e1578b09d9 /include/linux/string.h | |
| parent | c6b6fc206586cc07a18595d2a3d815a806a057d0 (diff) | |
| parent | 8c4d2a0bfbd27d030e4652b714cd5a1598f3559b (diff) | |
Merge tag 'asoc-v5.5-2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: More updates for v5.5
Some more development work for v5.5. Highlights include:
- More cleanups from Morimoto-san.
- Trigger word detection for RT5677.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/linux/string.h')
| -rw-r--r-- | include/linux/string.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/include/linux/string.h b/include/linux/string.h index b2f9df7f0761..b6ccdc2c7f02 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -227,7 +227,26 @@ static inline bool strstarts(const char *str, const char *prefix) } size_t memweight(const void *ptr, size_t bytes); -void memzero_explicit(void *s, size_t count); + +/** + * memzero_explicit - Fill a region of memory (e.g. sensitive + * keying data) with 0s. + * @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. + */ +static inline void memzero_explicit(void *s, size_t count) +{ + memset(s, 0, count); + barrier_data(s); +} /** * kbasename - return the last part of a pathname. |
