Hello,

attached patch fixes SIGSEGV with 64-bit userspace. The memmem is implicit with int but it get signed extended when cast to rt. Cannot include correct headers
because of the kernel one. I also fixed the print output (it should not hurt).

Signed-off-by: Rudolf Marek <[EMAIL PROTECTED]>


Thanks,
Rudolf
Index: util/getpir/getpir.c
===================================================================
--- util/getpir/getpir.c	(revision 2584)
+++ util/getpir/getpir.c	(working copy)
@@ -10,6 +10,9 @@
 
 #define O_RDONLY 0x00
 
+void *memmem(const void *haystack, size_t haystacklen,
+                    const void *needle, size_t needlelen);
+
 static struct irq_routing_table *probe_table(int fd_mem)
 {
 	char *ptr, signature[] = "$PIR";
@@ -21,7 +24,7 @@
 	rt = (struct irq_routing_table *) memmem(ptr, 0xFFFF, signature, 4);
 
 	if (rt != NULL) {
-		printf("Found PCI IRQ Routing table signature at 0x%04x of system memory\n",
+		printf("Found PCI IRQ Routing table signature at 0x%04lx of system memory\n",
 		       (char *) rt - ptr + 0xf0000);
 	} else {
 		printf("No PCI IRQ Routing table signature in the memory\n");		
-- 
linuxbios mailing list
[email protected]
http://www.linuxbios.org/mailman/listinfo/linuxbios

Reply via email to