All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] arm: socfpga: Fix mailbox command length checking
@ 2019-04-11  9:37 Ley Foon Tan
  2019-04-11  9:37 ` [U-Boot] [PATCH v2] arm: socfpga: mailbox: Fix off-by-one error on " Ley Foon Tan
  2019-04-11  9:39 ` [U-Boot] [PATCH] arm: socfpga: Fix mailbox " Ley Foon Tan
  0 siblings, 2 replies; 8+ messages in thread
From: Ley Foon Tan @ 2019-04-11  9:37 UTC (permalink / raw)
  To: u-boot

A mailbox command including header + arguments.
But, "len" only including length of arguments, it missed the length
of header in checking.
Includes length of header (1) when checking the space size.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
---
 arch/arm/mach-socfpga/mailbox_s10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-socfpga/mailbox_s10.c
index 3c33223936..8363c93e90 100644
--- a/arch/arm/mach-socfpga/mailbox_s10.c
+++ b/arch/arm/mach-socfpga/mailbox_s10.c
@@ -59,7 +59,7 @@ static __always_inline int mbox_fill_cmd_circular_buff(u32 header, u32 len,
 	 */
 	if (((cin + 1) % MBOX_CMD_BUFFER_SIZE) == cout ||
 	    ((MBOX_CMD_BUFFER_SIZE - cin + cout - 1) %
-	     MBOX_CMD_BUFFER_SIZE) < len)
+	     MBOX_CMD_BUFFER_SIZE) < (len + 1))
 		return -ENOMEM;
 
 	/* write header to circular buffer */
-- 
2.19.0

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

* [U-Boot] [PATCH v2] arm: socfpga: mailbox: Fix off-by-one error on command length checking
  2019-04-11  9:37 [U-Boot] [PATCH] arm: socfpga: Fix mailbox command length checking Ley Foon Tan
@ 2019-04-11  9:37 ` Ley Foon Tan
  2019-04-16  6:32   ` Ley Foon Tan
  2019-04-11  9:39 ` [U-Boot] [PATCH] arm: socfpga: Fix mailbox " Ley Foon Tan
  1 sibling, 1 reply; 8+ messages in thread
From: Ley Foon Tan @ 2019-04-11  9:37 UTC (permalink / raw)
  To: u-boot

A mailbox command contains of header + arguments.
But, "len" is only including length of arguments, off-by-one for
length of header in checking.
Includes length of header (1) when checking the space size.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
---
 arch/arm/mach-socfpga/mailbox_s10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-socfpga/mailbox_s10.c
index 3c33223936..8363c93e90 100644
--- a/arch/arm/mach-socfpga/mailbox_s10.c
+++ b/arch/arm/mach-socfpga/mailbox_s10.c
@@ -59,7 +59,7 @@ static __always_inline int mbox_fill_cmd_circular_buff(u32 header, u32 len,
 	 */
 	if (((cin + 1) % MBOX_CMD_BUFFER_SIZE) == cout ||
 	    ((MBOX_CMD_BUFFER_SIZE - cin + cout - 1) %
-	     MBOX_CMD_BUFFER_SIZE) < len)
+	     MBOX_CMD_BUFFER_SIZE) < (len + 1))
 		return -ENOMEM;
 
 	/* write header to circular buffer */
-- 
2.19.0

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

* [U-Boot] [PATCH] arm: socfpga: Fix mailbox command length checking
  2019-04-11  9:37 [U-Boot] [PATCH] arm: socfpga: Fix mailbox command length checking Ley Foon Tan
  2019-04-11  9:37 ` [U-Boot] [PATCH v2] arm: socfpga: mailbox: Fix off-by-one error on " Ley Foon Tan
@ 2019-04-11  9:39 ` Ley Foon Tan
  1 sibling, 0 replies; 8+ messages in thread
From: Ley Foon Tan @ 2019-04-11  9:39 UTC (permalink / raw)
  To: u-boot

On Thu, Apr 11, 2019 at 5:37 PM Ley Foon Tan <ley.foon.tan@intel.com> wrote:
>
> A mailbox command including header + arguments.
> But, "len" only including length of arguments, it missed the length
> of header in checking.
> Includes length of header (1) when checking the space size.
>
> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
> Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
> ---
>  arch/arm/mach-socfpga/mailbox_s10.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-socfpga/mailbox_s10.c
> index 3c33223936..8363c93e90 100644
> --- a/arch/arm/mach-socfpga/mailbox_s10.c
> +++ b/arch/arm/mach-socfpga/mailbox_s10.c
> @@ -59,7 +59,7 @@ static __always_inline int mbox_fill_cmd_circular_buff(u32 header, u32 len,
>          */
>         if (((cin + 1) % MBOX_CMD_BUFFER_SIZE) == cout ||
>             ((MBOX_CMD_BUFFER_SIZE - cin + cout - 1) %
> -            MBOX_CMD_BUFFER_SIZE) < len)
> +            MBOX_CMD_BUFFER_SIZE) < (len + 1))
>                 return -ENOMEM;
>
>         /* write header to circular buffer */
> --
> 2.19.0
>
Please ignore this, Resend accidentally.

Ley Foon

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

* [U-Boot] [PATCH v2] arm: socfpga: mailbox: Fix off-by-one error on command length checking
  2019-04-11  9:37 ` [U-Boot] [PATCH v2] arm: socfpga: mailbox: Fix off-by-one error on " Ley Foon Tan
@ 2019-04-16  6:32   ` Ley Foon Tan
  0 siblings, 0 replies; 8+ messages in thread
From: Ley Foon Tan @ 2019-04-16  6:32 UTC (permalink / raw)
  To: u-boot

On Thu, Apr 11, 2019 at 5:37 PM Ley Foon Tan <ley.foon.tan@intel.com> wrote:
>
> A mailbox command contains of header + arguments.
> But, "len" is only including length of arguments, off-by-one for
> length of header in checking.
> Includes length of header (1) when checking the space size.
>
> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
> Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
> ---
>  arch/arm/mach-socfpga/mailbox_s10.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-socfpga/mailbox_s10.c
> index 3c33223936..8363c93e90 100644
> --- a/arch/arm/mach-socfpga/mailbox_s10.c
> +++ b/arch/arm/mach-socfpga/mailbox_s10.c
> @@ -59,7 +59,7 @@ static __always_inline int mbox_fill_cmd_circular_buff(u32 header, u32 len,
>          */
>         if (((cin + 1) % MBOX_CMD_BUFFER_SIZE) == cout ||
>             ((MBOX_CMD_BUFFER_SIZE - cin + cout - 1) %
> -            MBOX_CMD_BUFFER_SIZE) < len)
> +            MBOX_CMD_BUFFER_SIZE) < (len + 1))
>                 return -ENOMEM;
>
>         /* write header to circular buffer */
Hi Marek

Are you okay with the new commit message?
Thanks.

Regards
Ley Foon

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

* [U-Boot] [PATCH] arm: socfpga: Fix mailbox command length checking
  2019-04-11  9:16   ` Ley Foon Tan
@ 2019-04-11  9:19     ` Marek Vasut
  0 siblings, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2019-04-11  9:19 UTC (permalink / raw)
  To: u-boot

On 4/11/19 11:16 AM, Ley Foon Tan wrote:
> On Thu, Apr 11, 2019 at 3:58 PM Marek Vasut <marex@denx.de> wrote:
>>
>> On 4/11/19 9:39 AM, Ley Foon Tan wrote:
>>> A mailbox command including header + arguments.
>>> But, "len" only including length of arguments, it missed the length
>>> of header in checking.
>>> Includes length of header (1) when checking the space size.
>>
>> I think the commit message could use some improvement, maybe reword it
>> so it's clear what you're fixing here. I guess it's some off-by-one error ?
> Okay, will resend again.

Thanks. The patch itself is fine.

-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH] arm: socfpga: Fix mailbox command length checking
  2019-04-11  7:58 ` Marek Vasut
@ 2019-04-11  9:16   ` Ley Foon Tan
  2019-04-11  9:19     ` Marek Vasut
  0 siblings, 1 reply; 8+ messages in thread
From: Ley Foon Tan @ 2019-04-11  9:16 UTC (permalink / raw)
  To: u-boot

On Thu, Apr 11, 2019 at 3:58 PM Marek Vasut <marex@denx.de> wrote:
>
> On 4/11/19 9:39 AM, Ley Foon Tan wrote:
> > A mailbox command including header + arguments.
> > But, "len" only including length of arguments, it missed the length
> > of header in checking.
> > Includes length of header (1) when checking the space size.
>
> I think the commit message could use some improvement, maybe reword it
> so it's clear what you're fixing here. I guess it's some off-by-one error ?
Okay, will resend again.

Thanks.

Regards
Ley Foon

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

* [U-Boot] [PATCH] arm: socfpga: Fix mailbox command length checking
  2019-04-11  7:39 Ley Foon Tan
@ 2019-04-11  7:58 ` Marek Vasut
  2019-04-11  9:16   ` Ley Foon Tan
  0 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2019-04-11  7:58 UTC (permalink / raw)
  To: u-boot

On 4/11/19 9:39 AM, Ley Foon Tan wrote:
> A mailbox command including header + arguments.
> But, "len" only including length of arguments, it missed the length
> of header in checking.
> Includes length of header (1) when checking the space size.

I think the commit message could use some improvement, maybe reword it
so it's clear what you're fixing here. I guess it's some off-by-one error ?

> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
> Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
> ---
>  arch/arm/mach-socfpga/mailbox_s10.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-socfpga/mailbox_s10.c
> index 3c33223936..8363c93e90 100644
> --- a/arch/arm/mach-socfpga/mailbox_s10.c
> +++ b/arch/arm/mach-socfpga/mailbox_s10.c
> @@ -59,7 +59,7 @@ static __always_inline int mbox_fill_cmd_circular_buff(u32 header, u32 len,
>  	 */
>  	if (((cin + 1) % MBOX_CMD_BUFFER_SIZE) == cout ||
>  	    ((MBOX_CMD_BUFFER_SIZE - cin + cout - 1) %
> -	     MBOX_CMD_BUFFER_SIZE) < len)
> +	     MBOX_CMD_BUFFER_SIZE) < (len + 1))
>  		return -ENOMEM;
>  
>  	/* write header to circular buffer */
> 


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH] arm: socfpga: Fix mailbox command length checking
@ 2019-04-11  7:39 Ley Foon Tan
  2019-04-11  7:58 ` Marek Vasut
  0 siblings, 1 reply; 8+ messages in thread
From: Ley Foon Tan @ 2019-04-11  7:39 UTC (permalink / raw)
  To: u-boot

A mailbox command including header + arguments.
But, "len" only including length of arguments, it missed the length
of header in checking.
Includes length of header (1) when checking the space size.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Chee Hong Ang <chee.hong.ang@intel.com>
---
 arch/arm/mach-socfpga/mailbox_s10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-socfpga/mailbox_s10.c
index 3c33223936..8363c93e90 100644
--- a/arch/arm/mach-socfpga/mailbox_s10.c
+++ b/arch/arm/mach-socfpga/mailbox_s10.c
@@ -59,7 +59,7 @@ static __always_inline int mbox_fill_cmd_circular_buff(u32 header, u32 len,
 	 */
 	if (((cin + 1) % MBOX_CMD_BUFFER_SIZE) == cout ||
 	    ((MBOX_CMD_BUFFER_SIZE - cin + cout - 1) %
-	     MBOX_CMD_BUFFER_SIZE) < len)
+	     MBOX_CMD_BUFFER_SIZE) < (len + 1))
 		return -ENOMEM;
 
 	/* write header to circular buffer */
-- 
2.19.0

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

end of thread, other threads:[~2019-04-16  6:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11  9:37 [U-Boot] [PATCH] arm: socfpga: Fix mailbox command length checking Ley Foon Tan
2019-04-11  9:37 ` [U-Boot] [PATCH v2] arm: socfpga: mailbox: Fix off-by-one error on " Ley Foon Tan
2019-04-16  6:32   ` Ley Foon Tan
2019-04-11  9:39 ` [U-Boot] [PATCH] arm: socfpga: Fix mailbox " Ley Foon Tan
  -- strict thread matches above, loose matches on Subject: below --
2019-04-11  7:39 Ley Foon Tan
2019-04-11  7:58 ` Marek Vasut
2019-04-11  9:16   ` Ley Foon Tan
2019-04-11  9:19     ` Marek Vasut

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.