From patchwork Sun Jun 20 17:19:06 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Achatz X-Patchwork-Id: 107060 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5KHJOW4009841 for ; Sun, 20 Jun 2010 17:19:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755625Ab0FTRTL (ORCPT ); Sun, 20 Jun 2010 13:19:11 -0400 Received: from mail-in-16.arcor-online.net ([151.189.21.56]:59197 "EHLO mail-in-16.arcor-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755500Ab0FTRTK (ORCPT ); Sun, 20 Jun 2010 13:19:10 -0400 Received: from mail-in-20-z2.arcor-online.net (mail-in-20-z2.arcor-online.net [151.189.8.85]) by mx.arcor.de (Postfix) with ESMTP id 169398545; Sun, 20 Jun 2010 19:19:08 +0200 (CEST) Received: from mail-in-14.arcor-online.net (mail-in-14.arcor-online.net [151.189.21.54]) by mail-in-20-z2.arcor-online.net (Postfix) with ESMTP id E8BB3E9B21; Sun, 20 Jun 2010 19:19:07 +0200 (CEST) Received: from [192.168.0.1] (dslb-084-057-041-078.pools.arcor-ip.net [84.57.41.78]) by mail-in-14.arcor-online.net (Postfix) with ESMTPS id 193009BF7F; Sun, 20 Jun 2010 19:19:07 +0200 (CEST) X-DKIM: Sendmail DKIM Filter v2.8.2 mail-in-14.arcor-online.net 193009BF7F Subject: [PATCH] HID: Fixing offset errors in bin_attribute read functions of roccat kone From: Stefan Achatz Reply-To: erazor_de@users.sourceforge.net To: Jiri Kosina , Stefan Achatz , Stephen Rothwell , Tejun Heo , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sun, 20 Jun 2010 19:19:06 +0200 Message-ID: <1277054346.10971.1.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 (2.28.3-1.fc12) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 20 Jun 2010 17:19:24 +0000 (UTC) diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c index fcc2ccc..f776957 100644 --- a/drivers/hid/hid-roccat-kone.c +++ b/drivers/hid/hid-roccat-kone.c @@ -272,7 +272,7 @@ static ssize_t kone_sysfs_read_settings(struct file *fp, struct kobject *kobj, count = sizeof(struct kone_settings) - off; mutex_lock(&kone->kone_lock); - memcpy(buf, &kone->settings + off, count); + memcpy(buf, ((char const *)&kone->settings) + off, count); mutex_unlock(&kone->kone_lock); return count; @@ -332,7 +332,7 @@ static ssize_t kone_sysfs_read_profilex(struct kobject *kobj, count = sizeof(struct kone_profile) - off; mutex_lock(&kone->kone_lock); - memcpy(buf, &kone->profiles[number - 1], sizeof(struct kone_profile)); + memcpy(buf, ((char const *)&kone->profiles[number - 1]) + off, count); mutex_unlock(&kone->kone_lock); return count;