From: Dan Carpenter <dan.carpenter@oracle.com>
To: KY Srinivasan <kys@microsoft.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
"olaf@aepfle.de" <olaf@aepfle.de>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"jasowang@redhat.com" <jasowang@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"vojtech@suse.cz" <vojtech@suse.cz>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
"apw@canonical.com" <apw@canonical.com>,
"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>
Subject: Re: [PATCH 1/1] Drivers: input: serio: New driver to support Hyper-V synthetic keyboard
Date: Mon, 16 Sep 2013 21:33:19 +0300 [thread overview]
Message-ID: <20130916183319.GM19256@mwanda> (raw)
In-Reply-To: <3e45f054c6e243eabf2896ab1dcf38d4@SN2PR03MB061.namprd03.prod.outlook.com>
Just roll something like the following into your patch.
regards,
dan carpenter
diff --git a/drivers/input/serio/hyperv-keyboard.c b/drivers/input/serio/hyperv-keyboard.c
index 0d4625f..262721b 100644
--- a/drivers/input/serio/hyperv-keyboard.c
+++ b/drivers/input/serio/hyperv-keyboard.c
@@ -151,15 +151,18 @@ static void hv_kbd_free_device(struct hv_kbd_dev *device)
}
static void hv_kbd_on_receive(struct hv_device *device,
- struct vmpacket_descriptor *packet)
+ struct vmpacket_descriptor *packet, size_t size)
{
struct synth_kbd_msg *msg;
struct hv_kbd_dev *kbd_dev = hv_get_drvdata(device);
struct synth_kbd_keystroke *ks_msg;
+ int offset;
u16 scan_code;
- msg = (struct synth_kbd_msg *)((unsigned long)packet +
- (packet->offset8 << 3));
+ offset = packet->offset8 << 3;
+ if (offset + sizeof(struct synth_kbd_protocol_response) > size)
+ return;
+ msg = (void *)packet + offset;
switch (msg->header.type) {
case SYNTH_KBD_PROTOCOL_RESPONSE:
@@ -220,7 +223,7 @@ static void hv_kbd_on_channel_callback(void *context)
break;
case VM_PKT_DATA_INBAND:
- hv_kbd_on_receive(device, desc);
+ hv_kbd_on_receive(device, desc, bytes_recvd);
break;
default:
next prev parent reply other threads:[~2013-09-16 18:37 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 5:28 [PATCH 1/1] Drivers: input: serio: New driver to support Hyper-V synthetic keyboard K. Y. Srinivasan
2013-09-16 8:21 ` Dan Carpenter
2013-09-16 14:46 ` KY Srinivasan
2013-09-16 15:05 ` Dan Carpenter
2013-09-16 16:56 ` KY Srinivasan
2013-09-16 17:09 ` Dmitry Torokhov
2013-09-16 18:29 ` KY Srinivasan
2013-09-16 18:33 ` Dan Carpenter [this message]
2013-09-16 18:42 ` KY Srinivasan
2013-09-16 20:13 ` Dan Carpenter
2013-09-16 21:55 ` KY Srinivasan
2013-09-16 22:13 ` Dan Carpenter
2013-09-16 22:16 ` Dmitry Torokhov
2013-09-16 15:20 ` Dmitry Torokhov
2013-09-16 15:52 ` KY Srinivasan
2013-09-16 17:13 ` Dmitry Torokhov
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=20130916183319.GM19256@mwanda \
--to=dan.carpenter@oracle.com \
--cc=apw@canonical.com \
--cc=devel@linuxdriverproject.org \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jasowang@redhat.com \
--cc=kys@microsoft.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olaf@aepfle.de \
--cc=vojtech@suse.cz \
/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).