git: 8f746f7e88d2 - stable/12 - random(4): Correct a bare zero to the appropriate enum
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 11 Feb 2022 05:54:51 UTC
The branch stable/12 has been updated by obrien:
URL: https://cgit.FreeBSD.org/src/commit/?id=8f746f7e88d2edc3d2f4e9814300c8b815e7335b
commit 8f746f7e88d2edc3d2f4e9814300c8b815e7335b
Author: Conrad Meyer <cem@FreeBSD.org>
AuthorDate: 2018-10-20 21:06:15 +0000
Commit: David E. O'Brien <obrien@FreeBSD.org>
CommitDate: 2022-02-11 05:36:12 +0000
random(4): Correct a bare zero to the appropriate enum
The convention for updating hc_destination[] is to index with a
random_entropy_source. Zero happens to match RANDOM_CACHED, which is
correct for this source (early random data). Spell the zero value as the
enum name instead of the magic constant.
No functional change.
(cherry picked from commit 93d587e4d0442c7e702995b53668081240eefba2)
---
sys/dev/random/random_harvestq.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sys/dev/random/random_harvestq.c b/sys/dev/random/random_harvestq.c
index 227000983e1e..c040649c17b2 100644
--- a/sys/dev/random/random_harvestq.c
+++ b/sys/dev/random/random_harvestq.c
@@ -415,7 +415,8 @@ random_harvestq_prime(void *unused __unused)
event.he_somecounter = (uint32_t)get_cyclecount();
event.he_size = count;
event.he_source = RANDOM_CACHED;
- event.he_destination = harvest_context.hc_destination[0]++;
+ event.he_destination =
+ harvest_context.hc_destination[RANDOM_CACHED]++;
memcpy(event.he_entropy, data + i, sizeof(event.he_entropy));
random_harvestq_fast_process_event(&event);
explicit_bzero(&event, sizeof(event));