diff options
author | Mark Brown <broonie@kernel.org> | 2014-11-14 17:56:33 +0000 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-11-14 17:56:33 +0000 |
commit | 11a266d2e5e6b73bfba337fb3ef21c8fd4fa4150 (patch) | |
tree | 3c4ca0079cb67feeaa6a678212ca6f4313cf5a69 /lib | |
parent | 5bca889af9ee712d0dac3b61b1cec79e7c99ec58 (diff) | |
parent | 9c3da88145da7cd96bb898bc0304d3f783d4c8b2 (diff) |
Merge tag 'v3.14.24' into linux-linaro-lsk-v3.14
This is the 3.14.24 stable release
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bitmap.c | 8 | ||||
-rw-r--r-- | lib/string.c | 16 |
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c index 06f7e4fe8d2d..e5c4ebe586ba 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -131,7 +131,9 @@ void __bitmap_shift_right(unsigned long *dst, lower = src[off + k]; if (left && off + k == lim - 1) lower &= mask; - dst[k] = upper << (BITS_PER_LONG - rem) | lower >> rem; + dst[k] = lower >> rem; + if (rem) + dst[k] |= upper << (BITS_PER_LONG - rem); if (left && k == lim - 1) dst[k] &= mask; } @@ -172,7 +174,9 @@ void __bitmap_shift_left(unsigned long *dst, upper = src[k]; if (left && k == lim - 1) upper &= (1UL << left) - 1; - dst[k + off] = lower >> (BITS_PER_LONG - rem) | upper << rem; + dst[k + off] = upper << rem; + if (rem) + dst[k + off] |= lower >> (BITS_PER_LONG - rem); if (left && k + off == lim - 1) dst[k + off] &= (1UL << left) - 1; } diff --git a/lib/string.c b/lib/string.c index e5878de4f101..43d0781daf47 100644 --- a/lib/string.c +++ b/lib/string.c @@ -586,6 +586,22 @@ void *memset(void *s, int c, size_t count) EXPORT_SYMBOL(memset); #endif +/** + * 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. + * + * memzero_explicit() doesn't need an arch-specific version as + * it just invokes the one of memset() implicitly. + */ +void memzero_explicit(void *s, size_t count) +{ + memset(s, 0, count); + OPTIMIZER_HIDE_VAR(s); +} +EXPORT_SYMBOL(memzero_explicit); + #ifndef __HAVE_ARCH_MEMCPY /** * memcpy - Copy one area of memory to another |