summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Minyard <minyard@acm.org>2005-05-01 08:59:10 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-01 08:59:10 -0700
commit35bc37a0e0979a091bcf5d9161ffe935b3aa998c (patch)
tree0b353b5b778acbb5698f7d27721d03ba72c04b9f
parent9206880198589670dfc33feb9d2e903c3492701f (diff)
downloadlinux-35bc37a0e0979a091bcf5d9161ffe935b3aa998c.tar.bz2
[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: Corey Minyard <minyard@acm.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 3522723eb6b8..7522bd5f94da 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -1526,8 +1526,17 @@ static int try_init_acpi(int intf_num, struct smi_info **new_info)
info->irq_setup = NULL;
}
- regspacings[intf_num] = spmi->addr.register_bit_width / 8;
- info->io.regspacing = spmi->addr.register_bit_width / 8;
+ if (spmi->addr.register_bit_width) {
+ /* A (hopefully) properly formed register bit width. */
+ regspacings[intf_num] = 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];
info->io.regsize = regsizes[intf_num];
regshifts[intf_num] = spmi->addr.register_bit_offset;