error: implicit declaration of function ‘copy_from_user’

编译内核模块出现以下错误:

error: implicit declaration of function ‘copy_from_user’ [-Werror=implicit-function-declaration]

解决办法:

添加头文件: #include <linux/uaccess.h>

原因:
asm/uaccess.h does not have copy_to_user on kernel > 4.11.

https://github.com/raspberrypi/linux/commit/701cac61d0250912b89cbc28589969530179099a#diff-073429958395ac01bbdf79a3face785d

https://github.com/raspberrypi/linux/commit/d597580d373774b1bdab84b3d26ff0b55162b916

Author Rewards

Leave a Reply

Your email address will not be published. Required fields are marked *