[PATCH] Fix for handling bad IPMI ACPI data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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 <[email protected]>

Index: linux-2.6.12-rc2/drivers/char/ipmi/ipmi_si_intf.c
===================================================================
--- linux-2.6.12-rc2.orig/drivers/char/ipmi/ipmi_si_intf.c
+++ linux-2.6.12-rc2/drivers/char/ipmi/ipmi_si_intf.c
@@ -1557,8 +1557,17 @@
 		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;

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux