git: b09c986c63ab - stable/13 - bus: Return 0 if reading an ivar fails
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 13 Dec 2025 22:02:31 UTC
The branch stable/13 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=b09c986c63abee739356005e26a480ea2d6d8782
commit b09c986c63abee739356005e26a480ea2d6d8782
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-12 18:53:02 +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
(cherry picked from commit 4c2295c15860e70c8bd3f05f9229d2fc40dfd50d)
---
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 ab1f3541d775..de9ee8ee286f 100644
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -867,7 +867,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); \