With the following code snippet: ... char buf[64]; ... if (copy_from_user(&buf, ubuf, cnt)) ... Even though the value of "&buf" equals "buf", but there is no need to get the address of the "buf" again. Use "buf" instead of "&buf". Link: http://lkml.kernel.org/r/20160418152329.18b72bea@debian
Showing the changes to kernel/trace (1 of 1 file). Show all
Unified · Split
| @@ -3664,7 +3664,7 @@ tracing_trace_options_write(struct file *filp, const char __user *ubuf, · 3663 unmodified lines | ||
| 3664 | 3664 | if (cnt >= sizeof(buf)) |
| 3665 | 3665 | return -EINVAL; |
| 3666 | 3666 | |
| 3667 | − if (copy_from_user(&buf, ubuf, cnt)) | |
| 3667 | + if (copy_from_user(buf, ubuf, cnt)) | |
| 3668 | 3668 | return -EFAULT; |
| 3669 | 3669 | |
| 3670 | 3670 | buf[cnt] = 0; |
| @@ -4537,7 +4537,7 @@ tracing_set_trace_write(struct file *filp, const char __user *ubuf, · 866 unmodified lines | ||
| 4537 | 4537 | if (cnt > MAX_TRACER_SIZE) |
| 4538 | 4538 | cnt = MAX_TRACER_SIZE; |
| 4539 | 4539 | |
| 4540 | − if (copy_from_user(&buf, ubuf, cnt)) | |
| 4540 | + if (copy_from_user(buf, ubuf, cnt)) | |
| 4541 | 4541 | return -EFAULT; |
| 4542 | 4542 | |
| 4543 | 4543 | buf[cnt] = 0; |
| @@ -5327,7 +5327,7 @@ static ssize_t tracing_clock_write(struct file *filp, const char __user *ubuf, · 783 unmodified lines | ||
| 5327 | 5327 | if (cnt >= sizeof(buf)) |
| 5328 | 5328 | return -EINVAL; |
| 5329 | 5329 | |
| 5330 | − if (copy_from_user(&buf, ubuf, cnt)) | |
| 5330 | + if (copy_from_user(buf, ubuf, cnt)) | |
| 5331 | 5331 | return -EFAULT; |
| 5332 | 5332 | |
| 5333 | 5333 | buf[cnt] = 0; |