NetBSD Problem Report #2683

From gnats  Sat Aug 10 01:20:02 1996
Received: from lola-granola.MIT.EDU by pain.lcs.mit.edu (8.7.5/8.7.3) with SMTP id BAA18158 for <gnats-bugs@gnats.netbsd.org>; Sat, 10 Aug 1996 01:18:33 -0400 (EDT)
Message-Id: <199608100518.BAA27338@lola-granola.MIT.EDU>
Date: Sat, 10 Aug 1996 01:18:31 -0400
From: Nathan J Williams <nathanw@mit.edu>
Reply-To: nathanw@mit.edu
To: gnats-bugs@NetBSD.ORG
Subject: disklabel can try to divide by zero
X-Send-Pr-Version: 3.95

>Number:         2683
>Category:       bin
>Synopsis:       disklabel can try to divide by zero
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 10 01:35:01 +0000 1996
>Closed-Date:    Sat Aug 10 18:03:15 +0000 1996
>Last-Modified:  Sat Aug 10 18:03:40 +0000 1996
>Originator:     Nathan J Williams
>Release:        1.2_BETA, roughly
>Organization:

>Environment:

NetBSD disc-gun 1.1 NetBSD 1.1 (GENERIC) #7: Tue Nov 21 20:16:32 MET 1995     pk@neon:/usr/src1/sys/arch/sparc/compile/GENERIC sparc

>Description:
>How-To-Repeat:
	Run disklabel on a SMD (7053 only?) disk that doesn't have a label. 
It coredumps with an FP exception, after trying to come up with a comment
field for the returned partition when lp->d_secpercyl is 0. 

>Fix:
	Avoid the "# (Cyl.  xxx - yyyy )" comment when lp->d_secpercyl is 0.

	Arguably, the xd driver should return 0 partitions instead of 1 empty
partition, but I don't consider this a problem.


*** disklabel.c.orig	Sat Aug 10 00:54:06 1996
--- disklabel.c	Sat Aug 10 00:57:59 1996
***************
*** 826,831 ****
--- 826,832 ----
  				fprintf(f, "%20.20s", "");
  				break;
  			}
+ 			if(lp->d_secpercyl!=0) {
  			        fprintf(f, "\t# (Cyl. %4d",
  			            pp->p_offset / lp->d_secpercyl);
  			        if (pp->p_offset % lp->d_secpercyl)
***************
*** 839,844 ****
--- 840,848 ----
  			        if (pp->p_size % lp->d_secpercyl)
  			             putc('*', f);
  			        fprintf(f, ")\n");
+                         }
+ 			else
+ 			        fprintf(f,"\n");
  		}
  	}
  	fflush(f);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: explorer 
State-Changed-When: Sat Aug 10 14:03:15 EDT 1996 
State-Changed-Why:  
Applied patch. 

From: Michael Graff <explorer@flame.org>
To: nathanw@mit.edu
Cc: gnats-bugs@NetBSD.ORG
Subject: Re: bin/2683: disklabel can try to divide by zero
Date: 10 Aug 1996 14:02:42 -0400

 Nathan J Williams <nathanw@MIT.EDU> writes:

 I committed these changes.  Thanks!

 BTW, it appears that you used cut and paste to put the patches in the
 pr.  Since tabs and spaces aren't the same critters, I had to apply this
 patch by hand.  It was short, but just a note.  :)

 Thanks again,
 --Michael
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.49 2026/05/14 01:52:41 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.