Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/broadcom Limit number of words we read..
details: https://anonhg.NetBSD.org/src/rev/dc5b185bc91e
branches: trunk
changeset: 350236:dc5b185bc91e
user: christos <christos%NetBSD.org@localhost>
date: Sun Jan 08 05:04:45 2017 +0000
description:
Limit number of words we read..
diffstat:
sys/arch/arm/broadcom/bcm53xx_rng.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (29 lines):
diff -r fa6c39e497a0 -r dc5b185bc91e sys/arch/arm/broadcom/bcm53xx_rng.c
--- a/sys/arch/arm/broadcom/bcm53xx_rng.c Sun Jan 08 05:02:08 2017 +0000
+++ b/sys/arch/arm/broadcom/bcm53xx_rng.c Sun Jan 08 05:04:45 2017 +0000
@@ -33,7 +33,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_rng.c,v 1.8 2015/04/13 21:18:40 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_rng.c,v 1.9 2017/01/08 05:04:45 christos Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -163,13 +163,14 @@
bcmrng_empty(struct bcmrng_softc *sc)
{
mutex_enter(sc->sc_lock);
+ uint32_t data[128];
size_t nwords = __SHIFTOUT(bcmrng_read_4(sc, RNG_STATUS), RNG_VAL);
if (nwords == 0) {
mutex_exit(sc->sc_lock);
return 0;
}
-
- uint32_t data[nwords];
+ if (nwords > __arraycount(data))
+ nords = __arraycount(data);
bcmrng_read_multi_4(sc, RNG_DATA, data, nwords);
Home |
Main Index |
Thread Index |
Old Index