Commit 35bc37a0 authored by Corey Minyard's avatar Corey Minyard Committed by Linus Torvalds

[PATCH] IPMI: fix for handling bad ACPI data

If the ACPI register bit width is zero (an invalid value) assume it is the
default spacing.  This avoids some coredumps on invalid data and makes some
systems work that have broken ACPI data.
Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 92068801
...@@ -1526,8 +1526,17 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info) ...@@ -1526,8 +1526,17 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info)
info->irq_setup = NULL; info->irq_setup = NULL;
} }
if (spmi->addr.register_bit_width) {
/* A (hopefully) properly formed register bit width. */
regspacings[intf_num] = spmi->addr.register_bit_width / 8; regspacings[intf_num] = spmi->addr.register_bit_width / 8;
info->io.regspacing = spmi->addr.register_bit_width / 8; info->io.regspacing = spmi->addr.register_bit_width / 8;
} else {
/* Some broken systems get this wrong and set the value
* to zero. Assume it is the default spacing. If that
* is wrong, too bad, the vendor should fix the tables. */
regspacings[intf_num] = DEFAULT_REGSPACING;
info->io.regspacing = DEFAULT_REGSPACING;
}
regsizes[intf_num] = regspacings[intf_num]; regsizes[intf_num] = regspacings[intf_num];
info->io.regsize = regsizes[intf_num]; info->io.regsize = regsizes[intf_num];
regshifts[intf_num] = spmi->addr.register_bit_offset; regshifts[intf_num] = spmi->addr.register_bit_offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment