git: f402078d0956 - main - device_pager: Assert that the handle is not NULL

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 13 Mar 2025 17:02:41 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=f402078d0956cfd6f6afcf998271e058c478e34a

commit f402078d0956cfd6f6afcf998271e058c478e34a
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-03-13 16:57:40 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-03-13 16:57:40 +0000

    device_pager: Assert that the handle is not NULL
    
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D49333
---
 sys/vm/device_pager.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c
index 0b3a2eb54d75..15626938ba95 100644
--- a/sys/vm/device_pager.c
+++ b/sys/vm/device_pager.c
@@ -138,6 +138,8 @@ cdev_pager_allocate(void *handle, enum obj_type tp,
 	vm_object_t object;
 	vm_pindex_t pindex;
 
+	KASSERT(handle != NULL, ("device pager with NULL handle"));
+
 	if (tp != OBJT_DEVICE && tp != OBJT_MGTDEVICE)
 		return (NULL);
 	KASSERT(tp == OBJT_MGTDEVICE || ops->cdev_pg_populate == NULL,