copy_from_user中的len最大范围是多少
我写了个驱动,从用户空间拷贝数据到内核空间,buf[65536]
copy_from_user(buf, data,65536)
这样可以吗?请问这是什么原因啊? 难道对数据最大长度有限制,还是我的程序出了问题?
谢谢!
板子抱错:Unable to handle kernel NULL pointer dereference at virtual address 00000070
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
Unable to handle kernel NULL pointer dereference at virtual address 0000001d
pgd = c0e481e8
[0000001d] *pgd=c0149008<1>Unable to handle kernel paging request at virtual address 80149800
Unable to handle kernel paging request at virtual address 8014981c
Unable to handle kernel NULL pointer dereference at virtual address 00000091
pgd = c0004000
[00000091] *pgd=00000000
Internal error: Oops: 3 [#1]
Modules linked in: ksflash
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
usigned long长度应该没有问题吧,确定问题是出在这个函数上?
函数很简单,就是用了copy_from_user(buf, data,65536)
我把copy_from_user(buf, data,6144)就可以
就是数据长度小于7000的都不会抱错。
来测试数据的数据长度的,还会有什么会影响呢?
buf[65536] ?行不行啊,用户栈空间也有大小限制的吧
buf[]要是在内核本上分配的会有问题。
copy_from_user()还没用过几次,ldd上说它会检测参数,并且可能会睡眠。
别的我就不知道了,还没看过别的书。
改用kmalloc分配buf试试~~