]> Git Repo - linux.git/commitdiff
debugfs: Fix debugfs_read_file_str()
authorDietmar Eggemann <[email protected]>
Thu, 27 May 2021 09:11:05 +0000 (11:11 +0200)
committerGreg Kroah-Hartman <[email protected]>
Fri, 4 Jun 2021 13:01:08 +0000 (15:01 +0200)
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) <[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]>
fs/debugfs/file.c

index e813acfaa6e8a1af2319eea3d865c4384eca2188..ba7c01cd9a5d2e762fba11fa185e356e2ee37e6f 100644 (file)
@@ -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;
This page took 0.058388 seconds and 4 git commands to generate.