path: root/fs/debugfs/file.c
diff options
authorDietmar Eggemann <>2021-05-27 11:11:05 +0200
committerGreg Kroah-Hartman <>2021-06-04 15:01:08 +0200
commitf501b6a2312e27fffe671d461770426fe5162184 (patch)
tree6af391ab1c113efbe29dd13c9ae7213eb6a00647 /fs/debugfs/file.c
parent8124c8a6b35386f73523d27eacb71b5364a68c4c (diff)
debugfs: Fix debugfs_read_file_str()
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: 9af0440ec86eb ("debugfs: Implement debugfs_create_str()") Reviewed-by: Steven Rostedt (VMware) <> Acked-by: Peter Zijlstra (Intel) <> Signed-off-by: Dietmar Eggemann <> Link: Signed-off-by: Greg Kroah-Hartman <>
Diffstat (limited to 'fs/debugfs/file.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c
index e813acfaa6e8..ba7c01cd9a5d 100644
--- a/fs/debugfs/file.c
+++ b/fs/debugfs/file.c
@@ -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);
return ret;