All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: socfpga: Fix mailbox command length checking
Date: Thu, 11 Apr 2019 09:58:14 +0200	[thread overview]
Message-ID: <ca846d77-a6ef-6d87-ed90-71b5c3868f77@denx.de> (raw)
In-Reply-To: <1554968374-24613-1-git-send-email-ley.foon.tan@intel.com>

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

  reply	other threads:[~2019-04-11  7:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11  7:39 [U-Boot] [PATCH] arm: socfpga: Fix mailbox command length checking Ley Foon Tan
2019-04-11  7:58 ` Marek Vasut [this message]
2019-04-11  9:16   ` Ley Foon Tan
2019-04-11  9:19     ` Marek Vasut
2019-04-11  9:37 Ley Foon Tan
2019-04-11  9:39 ` Ley Foon Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca846d77-a6ef-6d87-ed90-71b5c3868f77@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.