LinuxKPI: remove < 5.0 version support
We are not aware of any out-of-tree consumers anymore which would need KPI support for before Linux version 5. Update the two in-tree consumers to use the new KPI. This allows us to remove the extra version check and will also give access to {lower,upper}_32_bits() unconditionally. Sponsored-by: The FreeBSD Foundation Reviewed-by: hselasky, rlibby, rstone MFC-after: 2 weeks X-MFC: to 13 only Differential Revision: https://reviews.freebsd.org/D29391
This commit is contained in:
parent
f1069375d9
commit
3b1ecc9fa1
@ -52,11 +52,7 @@ copy_from_user(void *to, const void *from, unsigned long n)
|
||||
#define __copy_from_user(...) copy_from_user(__VA_ARGS__)
|
||||
#define __copy_in_user(...) copy_from_user(__VA_ARGS__)
|
||||
|
||||
#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000
|
||||
#define user_access_begin(ptr, len) access_ok(ptr, len)
|
||||
#else
|
||||
#define user_access_begin() do { } while (0)
|
||||
#endif
|
||||
#define user_access_end() do { } while (0)
|
||||
|
||||
#define unsafe_get_user(x, ptr, err) do { \
|
||||
|
@ -81,11 +81,8 @@
|
||||
|
||||
#define barrier() __asm__ __volatile__("": : :"memory")
|
||||
|
||||
#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000
|
||||
/* Moved from drm_os_freebsd.h */
|
||||
#define lower_32_bits(n) ((u32)(n))
|
||||
#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
|
||||
#endif
|
||||
|
||||
#define ___PASTE(a,b) a##b
|
||||
#define __PASTE(a,b) ___PASTE(a,b)
|
||||
|
@ -61,11 +61,7 @@
|
||||
#define put_user(_x, _p) __put_user(_x, _p)
|
||||
#define clear_user(...) linux_clear_user(__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);
|
||||
|
@ -838,7 +838,7 @@ printf("%s: Minor %d\n", __FUNCTION__, pIoctlPayload->hdr.MinorFunction);
|
||||
printf("%s: Add kek at index 0x%x wrapper 0x%x format 0x%x\n", __FUNCTION__, kek_add->kekIndex, kek_add->wrapperKekIndex, kek_add->blobFormat);
|
||||
|
||||
/* Copy kek_blob from user pointer to local buffer */
|
||||
if(access_ok(VERIFY_READ, kek_add->EncryptKekBlob, sizeof(kek_blob))) {
|
||||
if(access_ok(kek_add->EncryptKekBlob, sizeof(kek_blob))) {
|
||||
printf("%s: Starting copy from user %p to kernel %p\n", __FUNCTION__, kek_add->EncryptKekBlob, &kek_blob);
|
||||
if((rv = copy_from_user(&kek_blob, kek_add->EncryptKekBlob, sizeof(kek_blob))) != 0) {
|
||||
printf("%s: Copy error, %d left\n", __FUNCTION__, rv);
|
||||
@ -873,7 +873,7 @@ printf("%s: Minor %d\n", __FUNCTION__, pIoctlPayload->hdr.MinorFunction);
|
||||
printf("%s: Add dek at index 0x%x, table %x, kek index %x, blob format %x, entry size %x\n", __FUNCTION__, dek_index, dek_table, kek_index, blob_format, entry_sz);
|
||||
|
||||
/* Copy dek_blob from user pointer to local buffer */
|
||||
if(access_ok(VERIFY_READ, dek_add->dekBlob, sizeof(dek_blob))) {
|
||||
if(access_ok(dek_add->dekBlob, sizeof(dek_blob))) {
|
||||
printf("%s: Starting copy from user %p to kernel %p\n", __FUNCTION__, dek_add->dekBlob, &dek_blob);
|
||||
if((rv = copy_from_user(&dek_blob, dek_add->dekBlob, sizeof(dek_blob))) != 0) {
|
||||
printf("%s: Copy error, %d left\n", __FUNCTION__, rv);
|
||||
|
@ -856,8 +856,7 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!access_ok(VERIFY_WRITE,
|
||||
(void __user *) (unsigned long) ex_hdr.response,
|
||||
if (!access_ok((void __user *) (unsigned long) ex_hdr.response,
|
||||
(hdr.out_words + ex_hdr.provider_out_words) * 8)) {
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user