PD#SWPL-15143
Problem:
userspace program use the write() syscall to write the node.
when write the strlen() length content, it will fail.
Solution:
use the buf[size] to instead of buf[size-1]
Verify:
U200
Change-Id: I886d9a1cbf3da459476bca76c9a5708ecbc20afe
Signed-off-by: Ao Xu <ao.xu@amlogic.com>
if (copy_from_user(buf, ubuf, len))
return -EFAULT;
- buf[len - 1] = '\0';
+ if (buf[len - 1] == '\n')
+ buf[len - 1] = '\0';
+ buf[len] = '\0';
if (strncmp(buf, "0", 1) == 0) {
amc->dump_enable = 0;
if (copy_from_user(buf, ubuf, len))
return -EFAULT;
- buf[len - 1] = '\0';
+ if (buf[len - 1] == '\n')
+ buf[len - 1] = '\0';
+ buf[len] = '\0';
if (strncmp(buf, "1", 1) == 0) {
amc->blank_enable = 1;