From: Benson Leung <bleung@chromium.org>
To: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: jekarlson@gmail.com, kernel@esmil.dk,
Neil Armstrong <narmstrong@baylibre.com>,
Stefan Adolfsson <sadolfsson@chromium.org>,
Lee Jones <lee.jones@linaro.org>, Olof Johansson <olof@lixom.net>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mfd: cros-ec: copy the whole event in get_next_event_xfer
Date: Tue, 9 Oct 2018 20:44:12 -0700 [thread overview]
Message-ID: <CANLzEkt4FBZDSTiZqJNkKDFLojMtayVAgusg764nhOcpCDmSOQ@mail.gmail.com> (raw)
In-Reply-To: <84a0aba3-0793-1659-c70c-d5ece650f832@collabora.com>
Hi Enric,
On Wed, Oct 3, 2018 at 4:01 AM Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:
>
> Hi Emil,
>
> Many thanks to catch this and fix. Some comments below.
>
> You missed to add the v2, please send the next patch with v3 prefix.
>
> On 28/9/18 19:08, Emil Karlson wrote:
> > Commit 57e94c8b974db2d83c60e1139c89a70806abbea0 caused cros-ec keyboard events
> > be truncated on many chromebooks so that Left and Right keys on Column 12 were
> > always 0. Use ret as memcpy len to fix this.
> >
>
> That's fine
>
> > drivers/platform/chrome/cros_ec_proto.c:509
> > get_next_event_xfer uses ret from cros_ec_cmd_xfer for memcpy for msg->data len
> > drivers/platform/chrome/cros_ec_proto.c:445
> > cros_ec_cmd_xfer gets ret from send_command
> > drivers/platform/chrome/cros_ec_proto.c:93
> > send_command gets ret from bus specific xfer_fn
> > drivers/mfd/cros_ec_spi.c:598
> > cros_ec_cmd_xfer_spi copies len amount to ec_msg->data and returns len as ret
> > drivers/mfd/cros_ec_i2c.c:267
> > cros_ec_cmd_xfer_i2c copies len amount to ec_msg->data and returns len as ret
> >
> > so msg->data length is always the same as ret.
> >
>
> Instead of describe the different calls involved and the returns. I'd explain
> why using ret fixes the issue.
>
> > Fixes: 57e94c8b974d ("mfd: cros-ec: Increase maximum mkbp event size")
> > Signed-off-by: Emil Karlson <jekarlson@gmail.com>
> > ---
> > drivers/platform/chrome/cros_ec_proto.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
> > index 398393ab5df8..b6fd4838f60f 100644
> > --- a/drivers/platform/chrome/cros_ec_proto.c
> > +++ b/drivers/platform/chrome/cros_ec_proto.c
> > @@ -520,7 +520,7 @@ static int get_next_event_xfer(struct cros_ec_device *ec_dev,
> > ret = cros_ec_cmd_xfer(ec_dev, msg);
> > if (ret > 0) {
> > ec_dev->event_size = ret - 1;
> > - memcpy(&ec_dev->event_data, msg->data, ec_dev->event_size);
> > + memcpy(&ec_dev->event_data, msg->data, ret);
> > }
> >
> > return ret;
> >
>
> After thinking a bit more on this I think that how you fixed this is really
> clear. I was wondering if the downstream solution would be better but as is
> really late and will be good have this as urgent fix for the coming release I am
> happy with it. We can always send follow up patches to sync with the downstream
> version if is preferred.
>
> Neil, can you give us your Tested-by to have the make sure this doesn't break
> with protocol v1, I don't have such hardware.
>
> Benson, will be really good have this merged in this rc. Are you fine with this
> solution?
Yes, I'm fine with it. Let me get this ready and try to get it before
we run out of rcs of 4.19.
>
> BTW, you can add my in next version.
>
> Acked-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
--
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org
next prev parent reply other threads:[~2018-10-10 3:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-27 9:24 [PATCH] mfd: cros-ec: copy the whole event when msg->version is 0 Emil Karlson
2018-09-27 9:30 ` Emil Karlson
2018-09-28 12:15 ` Neil Armstrong
2018-09-28 17:08 ` [PATCH] mfd: cros-ec: copy the whole event in get_next_event_xfer Emil Karlson
2018-09-28 17:16 ` Emil Karlson
2018-10-03 11:01 ` Enric Balletbo i Serra
2018-10-03 13:41 ` Neil Armstrong
2018-10-03 18:43 ` [PATCH v3] " Emil Karlson
2018-10-10 5:06 ` Benson Leung
2018-10-10 3:44 ` Benson Leung [this message]
2018-09-28 20:27 ` [PATCH] mfd: cros-ec: copy the whole event when msg->version is 0 Emil Renner Berthing
2018-10-09 10:13 ` Lee Jones
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=CANLzEkt4FBZDSTiZqJNkKDFLojMtayVAgusg764nhOcpCDmSOQ@mail.gmail.com \
--to=bleung@chromium.org \
--cc=enric.balletbo@collabora.com \
--cc=jekarlson@gmail.com \
--cc=kernel@esmil.dk \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=narmstrong@baylibre.com \
--cc=olof@lixom.net \
--cc=sadolfsson@chromium.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).