All of lore.kernel.org
 help / color / mirror / Atom feed
* - romsignature-checksum-cleanup-2.patch removed from -mm tree
@ 2007-01-10 22:44 akpm
  2007-01-29 13:46 ` Rene Herman
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: akpm @ 2007-01-10 22:44 UTC (permalink / raw)
  To: rene.herman, ak, jeremy, rusty, zach, mm-commits


The patch titled
     romsignature/checksum cleanup
has been removed from the -mm tree.  Its filename was
     romsignature-checksum-cleanup-2.patch

This patch was dropped because x86_64 tree changes trashed it

------------------------------------------------------
Subject: romsignature/checksum cleanup
From: Rene Herman <rene.herman@gmail.com>

Remove the assumption that if the first page of an ISA ROM is mapped, it'll
all be mapped.  This'll also stop people reading this code from wondering
if they're looking at a bug.

Signed-off-by: Rene Herman <rene.herman@gmail.com>
Not-strongly-objected-to-by: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Zachary Amsden <zach@vmware.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 arch/i386/kernel/e820.c |   36 ++++++++++++++++++++++--------------
 1 files changed, 22 insertions(+), 14 deletions(-)

diff -puN arch/i386/kernel/e820.c~romsignature-checksum-cleanup-2 arch/i386/kernel/e820.c
--- a/arch/i386/kernel/e820.c~romsignature-checksum-cleanup-2
+++ a/arch/i386/kernel/e820.c
@@ -157,29 +157,31 @@ static struct resource standard_io_resou
 	.flags	= IORESOURCE_BUSY | IORESOURCE_IO
 } };
 
-static int romsignature(const unsigned char *x)
+#define ROMSIGNATURE 0xaa55
+
+static int __init romsignature(const unsigned char *rom)
 {
+	const unsigned short * const ptr = (const unsigned short *)rom;
 	unsigned short sig;
-	int ret = 0;
-	if (probe_kernel_address((const unsigned short *)x, sig) == 0)
-		ret = (sig == 0xaa55);
-	return ret;
+
+	return probe_kernel_address(ptr, sig) == 0 && sig == ROMSIGNATURE;
 }
 
-static int __init romchecksum(unsigned char *rom, unsigned long length)
+static int __init romchecksum(const unsigned char *rom, unsigned long length)
 {
-	unsigned char *p, sum = 0;
+	unsigned char sum, c;
 
-	for (p = rom; p < rom + length; p++)
-		sum += *p;
-	return sum == 0;
+	for (sum = 0; length && probe_kernel_address(rom++, c) == 0; length--)
+		sum += c;
+	return !length && !sum;
 }
 
 static void __init probe_roms(void)
 {
+	const unsigned char *rom;
 	unsigned long start, length, upper;
-	unsigned char *rom;
-	int	      i;
+	unsigned char c;
+	int i;
 
 	/* video rom */
 	upper = adapter_rom_resources[0].start;
@@ -190,8 +192,11 @@ static void __init probe_roms(void)
 
 		video_rom_resource.start = start;
 
+		if (probe_kernel_address(rom + 2, c) != 0)
+			continue;
+
 		/* 0 < length <= 0x7f * 512, historically */
-		length = rom[2] * 512;
+		length = c * 512;
 
 		/* if checksum okay, trust length byte */
 		if (length && romchecksum(rom, length))
@@ -225,8 +230,11 @@ static void __init probe_roms(void)
 		if (!romsignature(rom))
 			continue;
 
+		if (probe_kernel_address(rom + 2, c) != 0)
+			continue;
+
 		/* 0 < length <= 0x7f * 512, historically */
-		length = rom[2] * 512;
+		length = c * 512;
 
 		/* but accept any length that fits if checksum okay */
 		if (!length || start + length > upper || !romchecksum(rom, length))
_

Patches currently in -mm which might be from rene.herman@gmail.com are

romsignature-checksum-cleanup-2.patch

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-01-29 16:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-10 22:44 - romsignature-checksum-cleanup-2.patch removed from -mm tree akpm
2007-01-29 13:46 ` Rene Herman
2007-01-29 13:52   ` Andi Kleen
2007-01-29 13:46 ` [PATCH] i386: probe_roms() cleanup Rene Herman
2007-01-29 13:46 ` [PATCH] x86_64: sync up probe_roms() with i386 Rene Herman
2007-01-29 16:55   ` Rene Herman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.