From: Wei Li <redacted>
In the rv module, there are three read handlers that pass
'strlen(buff) + 1' to simple_read_from_buffer(). The terminator byte is
not data, so the read returns one extra byte. Pass strlen(buff)
instead.
Signed-off-by: Wei Li <redacted>
---
kernel/trace/rv/rv.c | 4 ++--
kernel/trace/rv/rv_reactors.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
index 7846e4092b9c..835d53978961 100644
--- a/kernel/trace/rv/rv.c
+++ b/kernel/trace/rv/rv.c
@@ -483,7 +483,7 @@ static ssize_t monitor_desc_read_data(struct file *filp, char __user *user_buf,
snprintf(buff, sizeof(buff), "%s\n", mon->description);
- return simple_read_from_buffer(user_buf, count, ppos, buff, strlen(buff) + 1);
+ return simple_read_from_buffer(user_buf, count, ppos, buff, strlen(buff));
}
static const struct file_operations interface_desc_fops = {@@ -752,7 +752,7 @@ static ssize_t monitoring_on_read_data(struct file *filp, char __user *user_buf,
buff = rv_monitoring_on() ? "1\n" : "0\n";
- return simple_read_from_buffer(user_buf, count, ppos, buff, strlen(buff) + 1);
+ return simple_read_from_buffer(user_buf, count, ppos, buff, strlen(buff));
}
static void turn_monitoring_off(void)
diff --git a/kernel/trace/rv/rv_reactors.c b/kernel/trace/rv/rv_reactors.c
index 06f21bcdd6cf..8a4f0740e3ab 100644
--- a/kernel/trace/rv/rv_reactors.c
+++ b/kernel/trace/rv/rv_reactors.c
@@ -353,7 +353,7 @@ static ssize_t reacting_on_read_data(struct file *filp,
buff = rv_reacting_on() ? "1\n" : "0\n";
- return simple_read_from_buffer(user_buf, count, ppos, buff, strlen(buff)+1);
+ return simple_read_from_buffer(user_buf, count, ppos, buff, strlen(buff));
}
static void turn_reacting_off(void)
--
2.55.0