Index: sys/kern/kern_sysctl.c =================================================================== --- sys/kern/kern_sysctl.c +++ sys/kern/kern_sysctl.c @@ -1784,7 +1784,7 @@ ktrsysctl(name, namelen); #endif - if (req.oldlen > PAGE_SIZE) { + if (req.oldptr && req.oldlen > PAGE_SIZE) { memlocked = 1; sx_xlock(&sysctlmemlock); } else