From fb2881a7134576a6e95a63e3d2f34ea5629db4a1 Mon Sep 17 00:00:00 2001 From: roel kluin Date: Mon, 3 Aug 2009 02:41:42 +0000 Subject: powerpc/macio: Don't the address of an array element before boundchecking Check whether index is within bounds before grabbing the element. Signed-off-by: Roel Kluin Signed-off-by: Benjamin Herrenschmidt --- drivers/macintosh/macio_asic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/macintosh') diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index a0f68386c12..588a5b0bc4b 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -294,10 +294,11 @@ static void macio_setup_interrupts(struct macio_dev *dev) int i = 0, j = 0; for (;;) { - struct resource *res = &dev->interrupt[j]; + struct resource *res; if (j >= MACIO_DEV_COUNT_IRQS) break; + res = &dev->interrupt[j]; irq = irq_of_parse_and_map(np, i++); if (irq == NO_IRQ) break; @@ -321,9 +322,10 @@ static void macio_setup_resources(struct macio_dev *dev, int index; for (index = 0; of_address_to_resource(np, index, &r) == 0; index++) { - struct resource *res = &dev->resource[index]; + struct resource *res; if (index >= MACIO_DEV_COUNT_RESOURCES) break; + res = &dev->resource[index]; *res = r; res->name = dev_name(&dev->ofdev.dev); -- cgit v1.2.3 From b8e4a7dae53760b9791aca96e74366078692d90f Mon Sep 17 00:00:00 2001 From: Lyonel Vincent Date: Sun, 30 Aug 2009 08:54:20 +0000 Subject: powerpc/powermac: Thermal control turns system off too eagerly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On certain PowerMacs, a module (therm_windtunnel) controls various thermal settings (it can report CPU/case temperature, change speed of internal fans, etc.) By default, the hardware thermal control has a temperature limit to protect the computer from damages (the default limit seems to be 80°C) but therm_windtunnel.c reduces it to an anormaly low value (65°C), which means that he computer will shut down randomly when hit by direct sun light or during summer (summer in France can be quite hot), actually possibly losing data instead of protecting it. The overheat limit in therm_windtunnel.c:253-254 should be set to 75°C and 70°C instead of 65°C and 60°C respectively. From: Lyonel Vincent Signed-off-by: Bartlomiej Zolnierkiewicz Signed-off-by: Benjamin Herrenschmidt --- drivers/macintosh/therm_windtunnel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/macintosh') diff --git a/drivers/macintosh/therm_windtunnel.c b/drivers/macintosh/therm_windtunnel.c index 40023313a76..8b9364434aa 100644 --- a/drivers/macintosh/therm_windtunnel.c +++ b/drivers/macintosh/therm_windtunnel.c @@ -239,8 +239,8 @@ setup_hardware( void ) * to be on the safe side (OSX doesn't)... */ if( x.overheat_temp == (80 << 8) ) { - x.overheat_temp = 65 << 8; - x.overheat_hyst = 60 << 8; + x.overheat_temp = 75 << 8; + x.overheat_hyst = 70 << 8; write_reg( x.thermostat, 2, x.overheat_hyst, 2 ); write_reg( x.thermostat, 3, x.overheat_temp, 2 ); -- cgit v1.2.3