c - 'bad address' error from copy_to_user -
i attempting copy custom struct kernel space user space. inside user space errno returns 'bad address'. usual cause of bad address error?
if(copy_to_user(info, &kernel_info, sizeof(struct prinfo)))
bad address error means address location have given invalid. case have above guess because passing copy of info instead of pointer info's memory location.
looking @ docs, copy_to_user defined as
copy_to_user(void __user * to, const void * from, unsigned long n); so unless info variable pointer update code be:
if(copy_to_user(&info, &kernel_info, sizeof(struct prinfo)) ) { //some stuff here guess }
Comments
Post a Comment