kernel: increase reliability, add ksu_access_ok to simplify

Co-authored-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
Signed-off-by: rsuntk <rsuntk@yukiprjkt.my.id>
This commit is contained in:
rsuntk
2025-07-22 22:31:58 +07:00
committed by ShirkNeko
parent 39811e311f
commit 0c87765958
4 changed files with 18 additions and 9 deletions

View File

@@ -178,3 +178,12 @@ long ksu_strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr,
return ret;
}
#endif
int ksu_access_ok(const void *addr, unsigned long size)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
return access_ok(addr, size);
#else
return access_ok(VERIFY_READ, addr, size);
#endif
}