Skip to content

Commit

Permalink
net/atm: fix proc_mpc_write 1 byte less calculated
Browse files Browse the repository at this point in the history
Then the input contains '\0' or '\n', proc_mpc_write has read them,
so the return value needs +1.

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
  • Loading branch information
cppcoffee authored and intel-lab-lkp committed Oct 13, 2022
1 parent 0326074 commit a873bf3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/atm/mpoa_proc.c
Expand Up @@ -224,8 +224,11 @@ static ssize_t proc_mpc_write(struct file *file, const char __user *buff,
free_page((unsigned long)page);
return -EFAULT;
}
if (*p == '\0' || *p == '\n')

if (*p == '\0' || *p == '\n') {
len += 1
break;
}
}

*p = '\0';
Expand Down

0 comments on commit a873bf3

Please sign in to comment.