All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hoan Tran <hotran@apm.com>
To: Wolfram Sang <wsa@the-dreams.de>, linux-i2c@vger.kernel.org
Cc: lkml <linux-kernel@vger.kernel.org>,
	Phil Endecott <phil_gjouf_endecott@chezphil.org>,
	Loc Ho <lho@apm.com>, Tin Huynh <tnhuynh@apm.com>,
	patches <patches@apm.com>, Hoan Tran <hotran@apm.com>
Subject: Re: [PATCH] i2c: xgene: Avoid dma_buffer overrun
Date: Mon, 24 Oct 2016 15:30:12 -0700	[thread overview]
Message-ID: <CAFHUOYwShBTVdpH8pMvGr9c8u-Fv+Hd081+XsW-wej94YwiB+g@mail.gmail.com> (raw)
In-Reply-To: <1476119590-21489-1-git-send-email-hotran@apm.com>

On Mon, Oct 10, 2016 at 10:13 AM, Hoan Tran <hotran@apm.com> wrote:
> SMBus block command uses the first byte of buffer for the data length.
> The dma_buffer should be increased by 1 to avoid the overrun issue.
>
> Reported-by: Phil Endecott <phil_gjouf_endecott@chezphil.org>
> Signed-off-by: Hoan Tran <hotran@apm.com>
> ---
>  drivers/i2c/busses/i2c-xgene-slimpro.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c
> index 4233f56..3c38029 100644
> --- a/drivers/i2c/busses/i2c-xgene-slimpro.c
> +++ b/drivers/i2c/busses/i2c-xgene-slimpro.c
> @@ -105,7 +105,7 @@ struct slimpro_i2c_dev {
>         struct mbox_chan *mbox_chan;
>         struct mbox_client mbox_client;
>         struct completion rd_complete;
> -       u8 dma_buffer[I2C_SMBUS_BLOCK_MAX];
> +       u8 dma_buffer[I2C_SMBUS_BLOCK_MAX + 1]; /* dma_buffer[0] is used for length */
>         u32 *resp_msg;
>  };
>
> --
> 1.9.1
>

Any comments on this patch.

Thanks
Hoan

  reply	other threads:[~2016-10-24 22:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-10 17:13 [PATCH] i2c: xgene: Avoid dma_buffer overrun Hoan Tran
2016-10-24 22:30 ` Hoan Tran [this message]
2016-10-25  9:50 ` Wolfram Sang

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=CAFHUOYwShBTVdpH8pMvGr9c8u-Fv+Hd081+XsW-wej94YwiB+g@mail.gmail.com \
    --to=hotran@apm.com \
    --cc=lho@apm.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@apm.com \
    --cc=phil_gjouf_endecott@chezphil.org \
    --cc=tnhuynh@apm.com \
    --cc=wsa@the-dreams.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.