git: d43bf55fc545 - main - armv7: Fix BeagleBone Black panic on system start
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 28 Apr 2023 20:04:40 UTC
The branch main has been updated by manu:
URL: https://cgit.FreeBSD.org/src/commit/?id=d43bf55fc5457dd0b95f19ebbffcc8d8501ea157
commit d43bf55fc5457dd0b95f19ebbffcc8d8501ea157
Author: Konrad Sewiłło-Jopek <kjopek@gmail.com>
AuthorDate: 2023-04-28 20:03:38 +0000
Commit: Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-04-28 20:03:57 +0000
armv7: Fix BeagleBone Black panic on system start
There is now assertion which requires all memory allocations of positive size.
Negative and zero-sized allocations lead to panic, so plug them off.
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D39846
---
sys/arm/ti/ti_sysc.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys/arm/ti/ti_sysc.c b/sys/arm/ti/ti_sysc.c
index 2f6011e3049d..603dec3334c2 100644
--- a/sys/arm/ti/ti_sysc.c
+++ b/sys/arm/ti/ti_sysc.c
@@ -306,6 +306,9 @@ parse_regfields(struct ti_sysc_softc *sc) {
/* Grab the content of reg properties */
nreg = OF_getproplen(node, "reg");
+ if (nreg <= 0)
+ return (ENXIO);
+
reg = malloc(nreg, M_DEVBUF, M_WAITOK);
OF_getencprop(node, "reg", reg, nreg);