aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-05-05 17:13:09 -0400
committerJiri Kosina <jkosina@suse.cz>2013-06-03 05:07:06 -0400
commit0d57eb8758c865a70dd05f7c6a857acd996167fa (patch)
treebbd99a0f26f82e47c85582f0c7157e97c57aa3dc /drivers
parent9f329741a6d7253f044677af00a999b47e85721e (diff)
HID: wiimote: fix DRM debug-attr to correctly parse input
We need to correctly zero-terminate the input to parse it. Otherwise, we always end up interpreting it as numbers. Furthermore, we actually want hexadecimal numbers instead of decimal. As it is a debugfs interface, we can change the API at any time. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/hid-wiimote-debug.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hid/hid-wiimote-debug.c b/drivers/hid/hid-wiimote-debug.c
index 6e76a2c3b00a..c13fb5bd79e8 100644
--- a/drivers/hid/hid-wiimote-debug.c
+++ b/drivers/hid/hid-wiimote-debug.c
@@ -141,7 +141,7 @@ static ssize_t wiidebug_drm_write(struct file *f, const char __user *u,
141 if (copy_from_user(buf, u, len)) 141 if (copy_from_user(buf, u, len))
142 return -EFAULT; 142 return -EFAULT;
143 143
144 buf[15] = 0; 144 buf[len] = 0;
145 145
146 for (i = 0; i < WIIPROTO_REQ_MAX; ++i) { 146 for (i = 0; i < WIIPROTO_REQ_MAX; ++i) {
147 if (!wiidebug_drmmap[i]) 147 if (!wiidebug_drmmap[i])
@@ -151,7 +151,7 @@ static ssize_t wiidebug_drm_write(struct file *f, const char __user *u,
151 } 151 }
152 152
153 if (i == WIIPROTO_REQ_MAX) 153 if (i == WIIPROTO_REQ_MAX)
154 i = simple_strtoul(buf, NULL, 10); 154 i = simple_strtoul(buf, NULL, 16);
155 155
156 spin_lock_irqsave(&dbg->wdata->state.lock, flags); 156 spin_lock_irqsave(&dbg->wdata->state.lock, flags);
157 dbg->wdata->state.flags &= ~WIIPROTO_FLAG_DRM_LOCKED; 157 dbg->wdata->state.flags &= ~WIIPROTO_FLAG_DRM_LOCKED;