Fix an off-by-one buffer overrun in inject_ue_write
Subsystems (3)
PATCH 1/1 Fix an off-by-one buffer overrun in inject_ue_write
--- drivers/edac/zynqmp_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/zynqmp_edac.c +1 -1
@@ -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 ;
Signature · 1 line
2.25.1
Michal Simek
maintainerYour subject is missing subsystem. Run git log on this driver to look at style.
Quoted 1 line · Yiyuan Guo
Signed-off-by Yiyuan Guo <[email protected]>
And there is missing commit message which describes the problem what you are facing.
Thanks,
Michal
PATCH v2 1/1 EDAC/zynqmp: Fix an off-by-one buffer overrun in inject_ue_write
In reply to Yiyuan Guoinject_ue_write() may access a local buffer buf at index len = sizeof(buf). Fix the length value to avoid buffer overrun.
--- drivers/edac/zynqmp_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/zynqmp_edac.c +1 -1
@@ -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 ;
Signature · 1 line
2.25.1
RE: [PATCH v2] EDAC/zynqmp: Fix an off-by-one buffer overrun in inject_ue_write
Quoted 14 lines
-----Original Message-----
From: Yiyuan Guo <[email protected]>
Sent: Thursday, June 29, 2023 9:21 PM
To: Datta, Shubhrajyoti <[email protected]>; Potthuri, Sai Krishna <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Simek, Michal <[email protected]>; [email protected]; linux-arm- [email protected]; [email protected]
Subject: [PATCH v2] EDAC/zynqmp: Fix an off-by-one buffer overrun ininject_ue_write
Quoted 4 lines
inject_ue_write()may access a local bufferbufat indexlen = sizeof(buf). Fix the length value to avoid buffer overrun.Signed-off-by Yiyuan Guo <[email protected]>
Quoted 20 lines
--- drivers/edac/zynqmp_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/edac/zynqmp_edac.c index renamed from drivers/edac/zynqmp_edac.c +0
-0
ac7d1e0b324c..bd9c1ff4b5e9100644drivers/edac/zynqmp_edac.c +1
-2@@ -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 ; --2.25.1