diff options
author | Sean Young | 2020-03-12 10:22:45 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab | 2020-04-21 12:53:53 +0200 |
commit | 953f10064140327868ac451eefb0db1becbef200 (patch) | |
tree | 7d61cc145d32f079365ffa1099a02019684f5635 /drivers | |
parent | e6940c03dd628a223f6cce6581686bdb2e09936b (diff) |
media: dvb: digitv: remove unused array element 0
The first element of the key array is not used. Remove it, and
along with it a uninitialized memory read.
This should fix the rc debug message.
Link: https://www.spinics.net/lists/kernel/msg3374861.html
Suggested-by: Phong Tran <tranmanphong@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/usb/dvb-usb/digitv.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/media/usb/dvb-usb/digitv.c b/drivers/media/usb/dvb-usb/digitv.c index 906438c5a40f..2a4b7ccd5489 100644 --- a/drivers/media/usb/dvb-usb/digitv.c +++ b/drivers/media/usb/dvb-usb/digitv.c @@ -230,14 +230,15 @@ static struct rc_map_table rc_map_digitv_table[] = { static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) { + struct rc_map_table *entry; int ret, i; - u8 key[5]; + u8 key[4]; u8 b[4] = { 0 }; *event = 0; *state = REMOTE_NO_KEY_PRESSED; - ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, &key[1], 4); + ret = digitv_ctrl_msg(d, USB_READ_REMOTE, 0, NULL, 0, key, 4); if (ret) return ret; @@ -248,20 +249,21 @@ static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) return ret; /* if something is inside the buffer, simulate key press */ - if (key[1] != 0) - { - for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { - if (rc5_custom(&d->props.rc.legacy.rc_map_table[i]) == key[1] && - rc5_data(&d->props.rc.legacy.rc_map_table[i]) == key[2]) { - *event = d->props.rc.legacy.rc_map_table[i].keycode; + if (key[0] != 0) { + for (i = 0; i < d->props.rc.legacy.rc_map_size; i++) { + entry = &d->props.rc.legacy.rc_map_table[i]; + + if (rc5_custom(entry) == key[0] && + rc5_data(entry) == key[1]) { + *event = entry->keycode; *state = REMOTE_KEY_PRESSED; return 0; } } + + deb_rc("key: %*ph\n", 4, key); } - if (key[0] != 0) - deb_rc("key: %*ph\n", 5, key); return 0; } |