git: 6e23ef9c5784 - stable/12 - debug_put_get: don't crash on null pointers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 31 Dec 2022 12:29:18 UTC
The branch stable/12 has been updated by vmaffione:
URL: https://cgit.FreeBSD.org/src/commit/?id=6e23ef9c5784af2d924b035b40805685db47163b
commit 6e23ef9c5784af2d924b035b40805685db47163b
Author: Vincenzo Maffione <vmaffione@FreeBSD.org>
AuthorDate: 2022-12-24 15:31:36 +0000
Commit: Vincenzo Maffione <vmaffione@FreeBSD.org>
CommitDate: 2022-12-31 12:14:25 +0000
debug_put_get: don't crash on null pointers
MFC after: 7 days
(cherry picked from commit 92e8b4a6301cc4ff4481e981c95c5b30b2a44506)
---
sys/dev/netmap/netmap_kern.h | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h
index b6f0f70c8ac8..ea124a332af8 100644
--- a/sys/dev/netmap/netmap_kern.h
+++ b/sys/dev/netmap/netmap_kern.h
@@ -1573,8 +1573,8 @@ void __netmap_adapter_get(struct netmap_adapter *na);
#define netmap_adapter_get(na) \
do { \
struct netmap_adapter *__na = na; \
- nm_prinf("getting %p:%s (%d)", __na, (__na)->name, (__na)->na_refcount); \
__netmap_adapter_get(__na); \
+ nm_prinf("getting %p:%s -> %d", __na, (__na)->name, (__na)->na_refcount); \
} while (0)
int __netmap_adapter_put(struct netmap_adapter *na);
@@ -1582,8 +1582,11 @@ int __netmap_adapter_put(struct netmap_adapter *na);
#define netmap_adapter_put(na) \
({ \
struct netmap_adapter *__na = na; \
- nm_prinf("putting %p:%s (%d)", __na, (__na)->name, (__na)->na_refcount); \
- __netmap_adapter_put(__na); \
+ if (__na == NULL) \
+ nm_prinf("putting NULL"); \
+ else \
+ nm_prinf("putting %p:%s -> %d", __na, (__na)->name, (__na)->na_refcount - 1); \
+ __netmap_adapter_put(__na); \
})
#else /* !NM_DEBUG_PUTGET */