Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1311805
| From | Andy Lutomirski <luto@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 2/3] dell-wmi: Fix hotkey table size check |
| Date | 2016-01-18 22:10 +0100 |
| Message-ID | <qSpdL-6bN-3@gated-at.bofh.it> (permalink) |
| References | <qSp47-5SG-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The minimum size of the table is 4, not 6. Replace the hard-coded
number with a sizeof expression. While we're at it, repace the
hard-coded 4 below as well.
Reported-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
drivers/platform/x86/dell-wmi.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/dell-wmi.c b/drivers/platform/x86/dell-wmi.c
index 5c0d037fcd40..48838942d593 100644
--- a/drivers/platform/x86/dell-wmi.c
+++ b/drivers/platform/x86/dell-wmi.c
@@ -111,7 +111,6 @@ struct dell_bios_keymap_entry {
struct dell_bios_hotkey_table {
struct dmi_header header;
struct dell_bios_keymap_entry keymap[];
-
};
struct dell_dmi_results {
@@ -329,12 +328,14 @@ static void __init handle_dmi_entry(const struct dmi_header *dm,
if (results->err || results->keymap)
return; /* We already found the hotkey table. */
- if (dm->type != 0xb2 || dm->length <= 6)
+ if (dm->type != 0xb2 ||
+ dm->length <= sizeof(struct dell_bios_hotkey_table))
return;
table = container_of(dm, struct dell_bios_hotkey_table, header);
- hotkey_num = (table->header.length - 4) /
+ hotkey_num = (table->header.length -
+ sizeof(struct dell_bios_hotkey_table)) /
sizeof(struct dell_bios_keymap_entry);
keymap = kcalloc(hotkey_num + 1, sizeof(struct key_entry), GFP_KERNEL);
--
2.5.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 0/3] dell-wmi: DMI misuse fixes Andy Lutomirski <luto@kernel.org> - 2016-01-18 22:00 +0100
[PATCH v2 2/3] dell-wmi: Fix hotkey table size check Andy Lutomirski <luto@kernel.org> - 2016-01-18 22:10 +0100
Re: [PATCH v2 2/3] dell-wmi: Fix hotkey table size check Jean Delvare <jdelvare@suse.de> - 2016-01-19 09:40 +0100
Re: [PATCH v2 2/3] dell-wmi: Fix hotkey table size check Andy Lutomirski <luto@amacapital.net> - 2016-01-19 19:50 +0100
[PATCH v2 1/3] dell-wmi: Stop storing pointers to DMI tables Andy Lutomirski <luto@kernel.org> - 2016-01-18 22:10 +0100
Re: [PATCH v2 1/3] dell-wmi: Stop storing pointers to DMI tables Jean Delvare <jdelvare@suse.de> - 2016-01-19 09:50 +0100
Re: [PATCH v2 1/3] dell-wmi: Stop storing pointers to DMI tables Jean Delvare <jdelvare@suse.de> - 2016-01-19 12:10 +0100
Re: [PATCH v2 1/3] dell-wmi: Stop storing pointers to DMI tables Andy Lutomirski <luto@amacapital.net> - 2016-01-19 19:30 +0100
[PATCH v2 3/3] dmi: Make dmi_walk and dmi_walk_early return real error codes Andy Lutomirski <luto@kernel.org> - 2016-01-18 22:10 +0100
Re: [PATCH v2 3/3] dmi: Make dmi_walk and dmi_walk_early return real error codes Jean Delvare <jdelvare@suse.de> - 2016-01-19 09:00 +0100
Re: [PATCH v2 3/3] dmi: Make dmi_walk and dmi_walk_early return real error codes Pali Rohár <pali.rohar@gmail.com> - 2016-01-19 09:40 +0100
Re: [PATCH v2 3/3] dmi: Make dmi_walk and dmi_walk_early return real error codes Pali Rohár <pali.rohar@gmail.com> - 2016-01-19 10:10 +0100
Re: [PATCH v2 3/3] dmi: Make dmi_walk and dmi_walk_early return real error codes Jean Delvare <jdelvare@suse.de> - 2016-01-19 10:50 +0100
Re: [PATCH v2 3/3] dmi: Make dmi_walk and dmi_walk_early return real error codes Andy Lutomirski <luto@amacapital.net> - 2016-01-20 01:00 +0100
Re: [PATCH v2 3/3] dmi: Make dmi_walk and dmi_walk_early return real error codes Jean Delvare <jdelvare@suse.de> - 2016-01-19 10:10 +0100
csiph-web