LinuxKPI: Update access_ok macro for v5.0.

Check LINUXKPI_VERSION macro for backwards compatibility.
It's recommended to update any drivers that depend on the older KPI
so we can deprecate < 5.0 code as we update to newer Linux version.
This patch is part of D19565

Reviewed by:	hps
Approved by:	imp (mentor), hps
MFC after:	1 week
This commit is contained in:
Johannes Lundberg 2019-05-16 17:44:17 +00:00
parent b961c0f244
commit 47e2723ad7
2 changed files with 8 additions and 3 deletions

View File

@ -60,12 +60,17 @@
#define get_user(_x, _p) linux_copyin((_p), &(_x), sizeof(*(_p)))
#define put_user(_x, _p) __put_user(_x, _p)
#define clear_user(...) linux_clear_user(__VA_ARGS__)
#define access_ok(...) linux_access_ok(__VA_ARGS__)
#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000
#define access_ok(a,b) linux_access_ok(a,b)
#else
#define access_ok(a,b,c) linux_access_ok(b,c)
#endif
extern int linux_copyin(const void *uaddr, void *kaddr, size_t len);
extern int linux_copyout(const void *kaddr, void *uaddr, size_t len);
extern size_t linux_clear_user(void *uaddr, size_t len);
extern int linux_access_ok(int rw, const void *uaddr, size_t len);
extern int linux_access_ok(const void *uaddr, size_t len);
/*
* NOTE: Each pagefault_disable() call must have a corresponding

View File

@ -897,7 +897,7 @@ linux_clear_user(void *_uaddr, size_t _len)
}
int
linux_access_ok(int rw, const void *uaddr, size_t len)
linux_access_ok(const void *uaddr, size_t len)
{
uintptr_t saddr;
uintptr_t eaddr;