Author: hailfinger
Date: Tue Jul 13 02:04:52 2010
New Revision: 1076
URL: http://flashrom.org/trac/coreboot/changeset/1076

Log:
Fix out-of-bounds ICH FREG permission printing. A bit was masked, but
not shifted, and that led to worst-case accesses of index 24 in an array
with 4 members.

I've improved readability in the variable declaration block as well.

Thanks to Stephen Kou for reporting the bug.

Signed-off-by: Carl-Daniel Hailfinger <[email protected]>
Acked-by: Stephen Kou <[email protected]>

Modified:
   trunk/chipset_enable.c

Modified: trunk/chipset_enable.c
==============================================================================
--- trunk/chipset_enable.c      Sun Jul 11 23:33:31 2010        (r1075)
+++ trunk/chipset_enable.c      Tue Jul 13 02:04:52 2010        (r1076)
@@ -452,10 +452,11 @@
                "Flash Descriptor", "BIOS", "Management Engine",
                "Gigabit Ethernet", "Platform Data"
        };
-       int rwperms = ((ICH_BRWA(frap) & (1 << i)) << 1) |
-                     ((ICH_BRRA(frap) & (1 << i)) << 0);
+       uint32_t base, limit;
+       int rwperms = (((ICH_BRWA(frap) >> i) & 1) << 1) |
+                     (((ICH_BRRA(frap) >> i) & 1) << 0);
        int offset = 0x54 + i * 4;
-       uint32_t freg = mmio_readl(ich_spibar + offset), base, limit;
+       uint32_t freg = mmio_readl(ich_spibar + offset);
 
        msg_pdbg("0x%02X: 0x%08x (FREG%i: %s)\n",
                     offset, freg, i, region_names[i]);

_______________________________________________
flashrom mailing list
[email protected]
http://www.flashrom.org/mailman/listinfo/flashrom

Reply via email to