git: 4c2295c15860 - main - bus: Return 0 if reading an ivar fails
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 Dec 2025 14:58:20 UTC
The branch main has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=4c2295c15860e70c8bd3f05f9229d2fc40dfd50d
commit 4c2295c15860e70c8bd3f05f9229d2fc40dfd50d
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-12-05 14:57:37 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-12-05 14:57:37 +0000
bus: Return 0 if reading an ivar fails
In the non-INVARIANTS case, return 0 rather than stack garbage if
reading an ivar fails (in the INVARIANTS case, we still panic).
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D54078
---
sys/sys/bus.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
index e0c6c590ce8d..86afc53da562 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -933,7 +933,7 @@ DECLARE_MODULE(_name##_##busname, _name##_##busname##_mod, \
static __inline type \
varp ## _get_ ## var(device_t dev) \
{ \
- uintptr_t v; \
+ uintptr_t v = 0; \
int e __diagused; \
e = BUS_READ_IVAR(device_get_parent(dev), dev, \
ivarp ## _IVAR_ ## ivar, &v); \