From patchwork Mon Sep 16 18:33:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 2899281 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 35216BFF05 for ; Mon, 16 Sep 2013 18:37:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2543920276 for ; Mon, 16 Sep 2013 18:37:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 51DA22027F for ; Mon, 16 Sep 2013 18:37:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752129Ab3IPShL (ORCPT ); Mon, 16 Sep 2013 14:37:11 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:43758 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751921Ab3IPShK (ORCPT ); Mon, 16 Sep 2013 14:37:10 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r8GIXU5P017409 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 16 Sep 2013 18:33:30 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r8GIXSmS012545 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 16 Sep 2013 18:33:29 GMT Received: from abhmt107.oracle.com (abhmt107.oracle.com [141.146.116.59]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r8GIXRPb006303; Mon, 16 Sep 2013 18:33:28 GMT Received: from mwanda (/41.210.129.101) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 16 Sep 2013 11:33:26 -0700 Date: Mon, 16 Sep 2013 21:33:19 +0300 From: Dan Carpenter To: KY Srinivasan Cc: Dmitry Torokhov , "olaf@aepfle.de" , "gregkh@linuxfoundation.org" , "jasowang@redhat.com" , "linux-kernel@vger.kernel.org" , "vojtech@suse.cz" , "linux-input@vger.kernel.org" , "apw@canonical.com" , "devel@linuxdriverproject.org" Subject: Re: [PATCH 1/1] Drivers: input: serio: New driver to support Hyper-V synthetic keyboard Message-ID: <20130916183319.GM19256@mwanda> References: <1379309334-25042-1-git-send-email-kys@microsoft.com> <20130916082110.GN25896@mwanda> <3b5096d0190b4440a8e25afbd22ab72d@SN2PR03MB061.namprd03.prod.outlook.com> <20130916150548.GO25896@mwanda> <20130916170951.GB20734@core.coreip.homeip.net> <3e45f054c6e243eabf2896ab1dcf38d4@SN2PR03MB061.namprd03.prod.outlook.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <3e45f054c6e243eabf2896ab1dcf38d4@SN2PR03MB061.namprd03.prod.outlook.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Just roll something like the following into your patch. regards, dan carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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: