Re: [PATCH] dell-wmi: Stop storing pointers to DMI tables
From: Andy Lutomirski
Date: Mon Jan 18 2016 - 13:19:55 EST
On Mon, Jan 18, 2016 at 10:09 AM, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
> On Mon, Jan 18, 2016 at 7:44 AM, Jean Delvare <jdelvare@xxxxxxx> wrote:
>>> +
>>> + if (dm->type != 0xb2 || dm->length <= 6)
>>> + return;
>>> +
>>> + table = container_of(dm, struct dell_bios_hotkey_table, header);
>>> +
>>> + hotkey_num = (table->header.length - 4) /
>>> + sizeof(struct dell_bios_keymap_entry);
>>
>> The problem is not introduced by your patch, but the length check is
>> inconsistent. sizeof(struct dell_bios_keymap_entry) is 4.
>
> Yes, but sizeof(struct dell_bios_keymap_table) is 6.
No it's not. It's 4. And my math below was all messed up, too.
You were exactly right, and I'll fix it.
--Andy