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>
This commit is contained in:
parent
9f329741a6
commit
0d57eb8758
1 changed files with 2 additions and 2 deletions
|
@ -141,7 +141,7 @@ static ssize_t wiidebug_drm_write(struct file *f, const char __user *u,
|
||||||
if (copy_from_user(buf, u, len))
|
if (copy_from_user(buf, u, len))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
buf[15] = 0;
|
buf[len] = 0;
|
||||||
|
|
||||||
for (i = 0; i < WIIPROTO_REQ_MAX; ++i) {
|
for (i = 0; i < WIIPROTO_REQ_MAX; ++i) {
|
||||||
if (!wiidebug_drmmap[i])
|
if (!wiidebug_drmmap[i])
|
||||||
|
@ -151,7 +151,7 @@ static ssize_t wiidebug_drm_write(struct file *f, const char __user *u,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == WIIPROTO_REQ_MAX)
|
if (i == WIIPROTO_REQ_MAX)
|
||||||
i = simple_strtoul(buf, NULL, 10);
|
i = simple_strtoul(buf, NULL, 16);
|
||||||
|
|
||||||
spin_lock_irqsave(&dbg->wdata->state.lock, flags);
|
spin_lock_irqsave(&dbg->wdata->state.lock, flags);
|
||||||
dbg->wdata->state.flags &= ~WIIPROTO_FLAG_DRM_LOCKED;
|
dbg->wdata->state.flags &= ~WIIPROTO_FLAG_DRM_LOCKED;
|
||||||
|
|
Loading…
Add table
Reference in a new issue