Skip to contentSkip to conversation

HID: Fixing offset errors in bin_attribute read functions of roccat kone

PATCH Applied Stefan Achatz 2 participants 2 messages Jun 20, 2010 – Jun 21, 2010

Subsystems (2)
lore
Share & tools
lore

Stefan Achatz

author maintainer
#0 lore raw

PATCH 1/1 HID: Fixing offset errors in bin_attribute read functions of roccat kone

Fixing wrong calculated offsets in bin_attribute read functions.

---
 drivers/hid/hid-roccat-kone.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hid-roccat-kone.c +2 -2
index fcc2ccc..f776957 100644
@@ -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;
Signature · 1 line
1.6.6.1
Applied
#1 lore raw
Quoted 1 line · Stefan Achatz

Fixing wrong calculated offsets in bin_attribute read functions.

Applied, thanks.

Signature · 2 lines
Jiri Kosina
SUSE Labs, Novell Inc.