git: 92e8b4a6301c - main - debug_put_get: don't crash on null pointers
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 24 Dec 2022 15:32:27 UTC
The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=92e8b4a6301cc4ff4481e981c95c5b30b2a44506 commit 92e8b4a6301cc4ff4481e981c95c5b30b2a44506 Author: Vincenzo Maffione <vmaffione@FreeBSD.org> AuthorDate: 2022-12-24 15:31:36 +0000 Commit: Vincenzo Maffione <vmaffione@FreeBSD.org> CommitDate: 2022-12-24 15:32:12 +0000 debug_put_get: don't crash on null pointers MFC after: 7 days --- 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 0c658c1e046d..6e6561ef7be4 100644 --- a/sys/dev/netmap/netmap_kern.h +++ b/sys/dev/netmap/netmap_kern.h @@ -1628,8 +1628,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); @@ -1637,8 +1637,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 */