diff mbox series

Fix an off-by-one buffer overrun in inject_ue_write

Message ID 20230629113933.4112456-1-yguoaz@gmail.com (mailing list archive)
State New, archived
Headers show
Series Fix an off-by-one buffer overrun in inject_ue_write | expand

Commit Message

yguoaz June 29, 2023, 11:39 a.m. UTC
Signed-off-by: Yiyuan Guo <yguoaz@gmail.com>
---
 drivers/edac/zynqmp_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michal Simek June 29, 2023, 3:04 p.m. UTC | #1
Your subject is missing subsystem. Run git log on this driver to look at style.

On 6/29/23 13:39, Yiyuan Guo wrote:
> Signed-off-by: Yiyuan Guo <yguoaz@gmail.com>

And there is missing commit message which describes the problem what you are facing.

Thanks,
Michal
diff mbox series

Patch

diff --git a/drivers/edac/zynqmp_edac.c b/drivers/edac/zynqmp_edac.c
index ac7d1e0b324c..bd9c1ff4b5e9 100644
--- a/drivers/edac/zynqmp_edac.c
+++ b/drivers/edac/zynqmp_edac.c
@@ -304,7 +304,7 @@  static ssize_t inject_ue_write(struct file *file, const char __user *data,
 	if (!data)
 		return -EFAULT;
 
-	len = min_t(size_t, count, sizeof(buf));
+	len = min_t(size_t, count, sizeof(buf) - 1);
 	if (copy_from_user(buf, data, len))
 		return -EFAULT;