Subject: port-i386/887: i386/machdep.c/dumpconf() bug
To: None <gnats-admin@NetBSD.ORG>
From: Kenneth Stailey <kstailey@leidecker.gsfc.nasa.gov>
List: netbsd-bugs
Date: 03/21/1995 04:05:10
>Number: 887
>Category: port-i386
>Synopsis: i386/machdep.c/dumpconf() bug
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Mar 21 04:05:06 1995
>Originator: Kenneth Stailey
>Organization:
???
>Release: March 18th tarballs (1.0 too from memory)
>Environment:
System: NetBSD pluto 1.0A NetBSD 1.0A (PLUTO) #19: Sat Mar 18 16:46:13 EST 1995 ken@pluto:/usr/src/sys/arch/i386/compile/PLUTO i386
>Description:
Signed vs. unsigned comparison inside i386/machdep.c always fails.
Lest you forget here's a sample program:
#include <stdio.h>
main()
{
unsigned u;
int i;
i = -3;
u = 1;
if (i < u)
printf("nope\n");
if (i < (signed)u)
printf("bingo\n");
}
Look at dumpconf inside i386/machdep.c, there's one there too.
"dumplo" is a long and "ctod(1)" is unsigned.
>How-To-Repeat:
Configure a NetBSD/i386 with a wd0b smaller than RAM.
Run savecore and get "savecore: read: Invalid argument"
>Fix:
--- machdep.c.DIST Tue Mar 21 06:41:16 1995
+++ machdep.c Tue Mar 21 06:41:25 1995
@@ -730,7 +730,7 @@
dumpsize = physmem;
/* Always skip the first CLBYTES, in case there is a label there. */
- if (dumplo < ctod(1))
+ if (dumplo < (signed)ctod(1))
dumplo = ctod(1);
/* Put dump at end of partition, and make it fit. */
--GAA03745.795786822/pluto.spacenet.com--
>Audit-Trail:
>Unformatted: