Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static long test_ioctl_ioctl(struct file *filp, unsigned int cmd,
struct test_ioctl_data *ioctl_data = filp->private_data;
int retval = 0;
unsigned char val;
int user_val = 0;
struct ioctl_arg data;
memset(&data, 0, sizeof(data));

Expand Down Expand Up @@ -75,7 +76,9 @@ static long test_ioctl_ioctl(struct file *filp, unsigned int cmd,
break;

case IOCTL_VALSET_NUM:
ioctl_num = arg;
if (get_user(user_val, (int __user *)arg))
return -EFAULT;
ioctl_num = user_val;
break;

default:
Expand Down