Trying to merge a vintage driver from kernel 2.6 to the latest kernel 5.8.
And encountered the following error:
macro "access_ok" passed 3 arguments, but takes just 2
The access_ok
is a macro defined in asm/uaccess.h
Here's the code fragment:
#include <asm/uaccess.h>
if (_IOC_DIR(cmd) & _IOC_READ)
err = !access_ok(VERIFY_WRITE, (void __user *)arg, _IOC_SIZE(cmd));
else if (_IOC_DIR(cmd) & _IOC_WRITE)
err = !access_ok(VERIFY_READ, (void __user *)arg, _IOC_SIZE(cmd));
if (err) return -EFAULT;
I did some googling but they all told me to switch to a lower version kernel that supports an access_ok
that takes in 3 arguments, obviously this didn't solve my problem.
So I want to know which macro could I replace access_ok
with?