Skip to content

Commit

Permalink
debugfs: Fix debugfs_read_file_str()
Browse files Browse the repository at this point in the history
Read the entire size of the buffer, including the trailing new line
character.
Discovered while reading the sched domain names of CPU0:

before:

cat /sys/kernel/debug/sched/domains/cpu0/domain*/name
SMTMCDIE

after:

cat /sys/kernel/debug/sched/domains/cpu0/domain*/name
SMT
MC
DIE

Fixes: 9af0440 ("debugfs: Implement debugfs_create_str()")
Reviewed-by: Steven Rostedt (VMware) <[email protected]>
Acked-by: Peter Zijlstra (Intel) <[email protected]>
Signed-off-by: Dietmar Eggemann <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
deggeman authored and gregkh committed Jun 4, 2021
1 parent 8124c8a commit f501b6a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/debugfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ ssize_t debugfs_read_file_str(struct file *file, char __user *user_buf,

copy[copy_len] = '\n';

ret = simple_read_from_buffer(user_buf, count, ppos, copy, copy_len);
ret = simple_read_from_buffer(user_buf, count, ppos, copy, len);
kfree(copy);

return ret;
Expand Down

0 comments on commit f501b6a

Please sign in to comment.