Skip to content

Commit c8a9c28

Browse files
Villemoesgregkh
authored andcommitted
debugfs: drop pointless nul-termination in debugfs_read_file_bool()
simple_read_from_buffer() doesn't care about any bytes in the buffer beyond "available". Making the buffer nul-terminated is therefore completely pointless. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Link: https://lore.kernel.org/r/20210326151411.732220-1-linux@rasmusvillemoes.dk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 72a91f1 commit c8a9c28

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎fs/debugfs/file.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ EXPORT_SYMBOL_GPL(debugfs_create_atomic_t);
773773
ssize_t debugfs_read_file_bool(struct file *file, char __user *user_buf,
774774
size_t count, loff_t *ppos)
775775
{
776-
char buf[3];
776+
char buf[2];
777777
bool val;
778778
int r;
779779
struct dentry *dentry = F_DENTRY(file);
@@ -789,7 +789,6 @@ ssize_t debugfs_read_file_bool(struct file *file, char __user *user_buf,
789789
else
790790
buf[0] = 'N';
791791
buf[1] = '\n';
792-
buf[2] = 0x00;
793792
return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
794793
}
795794
EXPORT_SYMBOL_GPL(debugfs_read_file_bool);

0 commit comments

Comments
 (0)