All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix an off-by-one buffer overrun in inject_ue_write
@ 2023-06-29 11:39 ` Yiyuan Guo
  0 siblings, 0 replies; 8+ messages in thread
From: Yiyuan Guo @ 2023-06-29 11:39 UTC (permalink / raw)
  To: shubhrajyoti.datta, sai.krishna.potthuri
  Cc: bp, tony.luck, james.morse, mchehab, rric, michal.simek,
	linux-edac, linux-arm-kernel, yguoaz

Signed-off-by: Yiyuan Guo <yguoaz@gmail.com>
---
 drivers/edac/zynqmp_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] Fix an off-by-one buffer overrun in inject_ue_write
@ 2023-06-29 11:39 ` Yiyuan Guo
  0 siblings, 0 replies; 8+ messages in thread
From: Yiyuan Guo @ 2023-06-29 11:39 UTC (permalink / raw)
  To: shubhrajyoti.datta, sai.krishna.potthuri
  Cc: bp, tony.luck, james.morse, mchehab, rric, michal.simek,
	linux-edac, linux-arm-kernel, yguoaz

Signed-off-by: Yiyuan Guo <yguoaz@gmail.com>
---
 drivers/edac/zynqmp_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] Fix an off-by-one buffer overrun in inject_ue_write
  2023-06-29 11:39 ` Yiyuan Guo
@ 2023-06-29 15:04   ` Michal Simek
  -1 siblings, 0 replies; 8+ messages in thread
From: Michal Simek @ 2023-06-29 15:04 UTC (permalink / raw)
  To: Yiyuan Guo, shubhrajyoti.datta, sai.krishna.potthuri
  Cc: bp, tony.luck, james.morse, mchehab, rric, linux-edac, linux-arm-kernel

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] Fix an off-by-one buffer overrun in inject_ue_write
@ 2023-06-29 15:04   ` Michal Simek
  0 siblings, 0 replies; 8+ messages in thread
From: Michal Simek @ 2023-06-29 15:04 UTC (permalink / raw)
  To: Yiyuan Guo, shubhrajyoti.datta, sai.krishna.potthuri
  Cc: bp, tony.luck, james.morse, mchehab, rric, linux-edac, linux-arm-kernel

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] EDAC/zynqmp: Fix an off-by-one buffer overrun in inject_ue_write
  2023-06-29 11:39 ` Yiyuan Guo
@ 2023-06-29 15:51   ` Yiyuan Guo
  -1 siblings, 0 replies; 8+ messages in thread
From: Yiyuan Guo @ 2023-06-29 15:51 UTC (permalink / raw)
  To: shubhrajyoti.datta, sai.krishna.potthuri
  Cc: bp, tony.luck, james.morse, mchehab, rric, michal.simek,
	linux-edac, linux-arm-kernel, yguoaz

inject_ue_write() may access a local buffer `buf` at index
`len = sizeof(buf)`. Fix the length value to avoid buffer overrun.

Signed-off-by: Yiyuan Guo <yguoaz@gmail.com>
---
 drivers/edac/zynqmp_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2] EDAC/zynqmp: Fix an off-by-one buffer overrun in inject_ue_write
@ 2023-06-29 15:51   ` Yiyuan Guo
  0 siblings, 0 replies; 8+ messages in thread
From: Yiyuan Guo @ 2023-06-29 15:51 UTC (permalink / raw)
  To: shubhrajyoti.datta, sai.krishna.potthuri
  Cc: bp, tony.luck, james.morse, mchehab, rric, michal.simek,
	linux-edac, linux-arm-kernel, yguoaz

inject_ue_write() may access a local buffer `buf` at index
`len = sizeof(buf)`. Fix the length value to avoid buffer overrun.

Signed-off-by: Yiyuan Guo <yguoaz@gmail.com>
---
 drivers/edac/zynqmp_edac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH v2] EDAC/zynqmp: Fix an off-by-one buffer overrun in inject_ue_write
  2023-06-29 15:51   ` Yiyuan Guo
@ 2023-07-11  9:12     ` Potthuri, Sai Krishna
  -1 siblings, 0 replies; 8+ messages in thread
From: Potthuri, Sai Krishna @ 2023-07-11  9:12 UTC (permalink / raw)
  To: Yiyuan Guo, Datta, Shubhrajyoti
  Cc: bp, tony.luck, james.morse, mchehab, rric, Simek, Michal,
	linux-edac, linux-arm-kernel



> -----Original Message-----
> From: Yiyuan Guo <yguoaz@gmail.com>
> Sent: Thursday, June 29, 2023 9:21 PM
> To: Datta, Shubhrajyoti <shubhrajyoti.datta@amd.com>; Potthuri, Sai Krishna
> <sai.krishna.potthuri@amd.com>
> Cc: bp@alien8.de; tony.luck@intel.com; james.morse@arm.com;
> mchehab@kernel.org; rric@kernel.org; Simek, Michal
> <michal.simek@amd.com>; linux-edac@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; yguoaz@gmail.com
> Subject: [PATCH v2] EDAC/zynqmp: Fix an off-by-one buffer overrun in
> inject_ue_write
> 
> inject_ue_write() may access a local buffer `buf` at index `len = sizeof(buf)`. Fix
> the length value to avoid buffer overrun.
> 
> Signed-off-by: Yiyuan Guo <yguoaz@gmail.com>

Reviewed-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>

> ---
>  drivers/edac/zynqmp_edac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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;
> 
> --
> 2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2] EDAC/zynqmp: Fix an off-by-one buffer overrun in inject_ue_write
@ 2023-07-11  9:12     ` Potthuri, Sai Krishna
  0 siblings, 0 replies; 8+ messages in thread
From: Potthuri, Sai Krishna @ 2023-07-11  9:12 UTC (permalink / raw)
  To: Yiyuan Guo, Datta, Shubhrajyoti
  Cc: bp, tony.luck, james.morse, mchehab, rric, Simek, Michal,
	linux-edac, linux-arm-kernel



> -----Original Message-----
> From: Yiyuan Guo <yguoaz@gmail.com>
> Sent: Thursday, June 29, 2023 9:21 PM
> To: Datta, Shubhrajyoti <shubhrajyoti.datta@amd.com>; Potthuri, Sai Krishna
> <sai.krishna.potthuri@amd.com>
> Cc: bp@alien8.de; tony.luck@intel.com; james.morse@arm.com;
> mchehab@kernel.org; rric@kernel.org; Simek, Michal
> <michal.simek@amd.com>; linux-edac@vger.kernel.org; linux-arm-
> kernel@lists.infradead.org; yguoaz@gmail.com
> Subject: [PATCH v2] EDAC/zynqmp: Fix an off-by-one buffer overrun in
> inject_ue_write
> 
> inject_ue_write() may access a local buffer `buf` at index `len = sizeof(buf)`. Fix
> the length value to avoid buffer overrun.
> 
> Signed-off-by: Yiyuan Guo <yguoaz@gmail.com>

Reviewed-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>

> ---
>  drivers/edac/zynqmp_edac.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 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;
> 
> --
> 2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-07-11  9:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-29 11:39 [PATCH] Fix an off-by-one buffer overrun in inject_ue_write Yiyuan Guo
2023-06-29 11:39 ` Yiyuan Guo
2023-06-29 15:04 ` Michal Simek
2023-06-29 15:04   ` Michal Simek
2023-06-29 15:51 ` [PATCH v2] EDAC/zynqmp: " Yiyuan Guo
2023-06-29 15:51   ` Yiyuan Guo
2023-07-11  9:12   ` Potthuri, Sai Krishna
2023-07-11  9:12     ` Potthuri, Sai Krishna

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.