[coreboot] [PATCH] sizeof doesn't always return long, it seems

Jens Rottmann JRottmann at LiPPERTEmbedded.de
Tue Aug 17 15:31:24 CEST 2010


coreboot: sizeof doesn't always return long, it seems

Correct for size_t would be %zx, but coreboot's printf doesn't support this.
Trying to keep it simple:  Two sizes are expected equal so use same %x for both.
Cast to unsigned int to make sure it fits.

Signed-off-by: Jens Rottmann <JRottmann at LiPPERTEmbedded.de>
---

Hi Myles,

you have changed this from %x to %lx with rev 5603.  But my gcc 4.3.2 (32 bits)
appearently doesn't like it.  Maybe you have a 64 bit system?

If my approach is ok for you, would you please commit?

Thanks,
Jens

--- src/arch/i386/boot/pirq_routing.c	(revision 5697)
+++ src/arch/i386/boot/pirq_routing.c	(working copy)
@@ -13,8 +13,8 @@
 	printk(BIOS_INFO, "Checking Interrupt Routing Table consistency...\n");
 
 	if (sizeof(struct irq_routing_table) != rt->size) {
-		printk(BIOS_WARNING, "Inconsistent Interrupt Routing Table size (0x%lx/0x%x).\n",
-			       sizeof(struct irq_routing_table),
+		printk(BIOS_WARNING, "Inconsistent Interrupt Routing Table size (0x%x/0x%x).\n",
+			       (unsigned int)sizeof(struct irq_routing_table),
 			       rt->size
 			);
 		rt->size=sizeof(struct irq_routing_table);
_




More information about the coreboot mailing list