c
< 	ptent = pte_mkuffd_wp(ptent);
---
> 	if (pte_present(ptent) && pte_valid(ptent) && pte_within_bounds(ptent)) {
> 		ptent = pte_mkuffd_wp(ptent);
> 	} else {
> 		// Handle the case where ptent is not valid
> 	}
