aboutsummaryrefslogtreecommitdiff
path: root/drivers/char
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2016-11-25 12:55:17 +0800
committerAlex Shi <alex.shi@linaro.org>2016-11-25 12:55:17 +0800
commit068e31608ab2e664dce897343a3e5d43c4f023e3 (patch)
tree8f3cb76ede9e94d1abe48d3f94f627bb8864272f /drivers/char
parent662d618b983cd0566a1cc2ed28c09a0a4b07b9f3 (diff)
parent5497d2d7d543b4b8854700d47a175e157fecbfd1 (diff)
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Conflicts: drivers/usb/gadget/function/u_ether.c
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/hw_random/core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c
index 6f497aa1b276..cf25020576fa 100644
--- a/drivers/char/hw_random/core.c
+++ b/drivers/char/hw_random/core.c
@@ -84,14 +84,14 @@ static size_t rng_buffer_size(void)
static void add_early_randomness(struct hwrng *rng)
{
- unsigned char bytes[16];
int bytes_read;
+ size_t size = min_t(size_t, 16, rng_buffer_size());
mutex_lock(&reading_mutex);
- bytes_read = rng_get_data(rng, bytes, sizeof(bytes), 1);
+ bytes_read = rng_get_data(rng, rng_buffer, size, 1);
mutex_unlock(&reading_mutex);
if (bytes_read > 0)
- add_device_randomness(bytes, bytes_read);
+ add_device_randomness(rng_buffer, bytes_read);
}
static inline void cleanup_rng(struct kref *kref)