NetBSD Problem Report #1588

From gnats  Thu Oct 12 07:53:13 1995
Received: from david.zfe.siemens.de by pain.lcs.mit.edu (8.6.9/8.6.9) with SMTP id HAA05937 for <gnats-bugs@netbsd.org>; Thu, 12 Oct 1995 07:47:39 -0400
Message-Id: <9510121145.AA13412@efg.zfe.siemens.de>
Date: Thu, 12 Oct 95 12:45:45 +0100
From: pohlj@arktur.zfe.siemens.de (Jochen Pohl)
Reply-To: jpo.drs@sni.de
To: gnats-bugs@netbsd.org
Subject: ccd(4) does not work for serially concatenated partitions
X-Send-Pr-Version: 3.2

>Number:         1588
>Category:       kern
>Synopsis:       ccd(4) does not work for serially concatenated partitions
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 12 08:05:02 +0000 1995
>Closed-Date:    Thu Oct 12 21:30:54 +0000 1995
>Last-Modified:  Thu Oct 12 21:31:31 +0000 1995
>Originator:     Jochen Pohl
>Release:        95/08/18
>Organization:
-------------------------------------------------------------------------------
Jochen Pohl, SNAT NC32			Email:	  jpo.drs@sni.de
Siemens-Nixdorf Advanced Technologies	
Scharfenberger Str. 66			Phone:    +49-351-844 2261
D-01133 Dresden				Fax:      +49-351-844 2011
>Environment:

System: NetBSD ariadne 1.0A NetBSD 1.0A (ARIADNE) #0: Sat Sep 30 19:47:33 MET 1995 jp@ariadne:/home/jp/co/src/sys/arch/i386/compile/ARIADNE i386


>Description:
	Creating a ccd with serially concatenated partitions produces a
	panic due to a reference of an invalid pointer in ccdinterleave().
	The following fix solves this problem, although there is probably
	still a memory leak.

	Another problem with ccd may be the generated disk geometry.
	Currently it may happen that secpercyl != nsectors * ntracks,
	which is at least confusing. This problem is also solved by
	the following fix.

>How-To-Repeat:

>Fix:
Index: src/sys/dev/ccd.c
diff -u src/sys/dev/ccd.c:1.1.1.2 src/sys/dev/ccd.c:1.2
--- src/sys/dev/ccd.c:1.1.1.2	Sun Aug 20 23:55:20 1995
+++ src/sys/dev/ccd.c	Sat Aug 26 13:45:00 1995
@@ -420,10 +420,8 @@
 	if (cs->sc_ileave == 0) {
 		bn = 0;
 		ii = cs->sc_itable;
-		/* Allocate space for ii_index. */
-		ii->ii_index = malloc(cs->sc_nccdisks, M_DEVBUF, M_WAITOK);
-
 		for (ix = 0; ix < cs->sc_nccdisks; ix++) {
+			ii->ii_index = malloc(1, M_DEVBUF, M_WAITOK);
 			ii->ii_ndisk = 1;
 			ii->ii_startblk = bn;
 			ii->ii_startoff = 0;
@@ -1055,6 +1053,7 @@
 			free(cs->sc_cinfo[i].ci_path, M_DEVBUF);
 		}
 		free(cs->sc_cinfo, M_DEVBUF);
+		/* XXX memory leak? */
 		free(cs->sc_itable->ii_index, M_DEVBUF);
 		free(cs->sc_itable, M_DEVBUF);
 		bzero(cs, sizeof(struct ccd_softc));
@@ -1249,7 +1248,8 @@
 	lp->d_nsectors = ccg->ccg_nsectors;
 	lp->d_ntracks = ccg->ccg_ntracks;
 	lp->d_ncylinders = ccg->ccg_ncylinders;
-	lp->d_secpercyl = lp->d_secperunit / lp->d_ncylinders;
+	lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks;
+	

 	strncpy(lp->d_typename, "ccd", sizeof(lp->d_typename));
 	lp->d_type = DTYPE_CCD;

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: thorpej 
State-Changed-When: Thu Oct 12 14:30:54 PDT 1995 
State-Changed-Why:  
Applied slightly modified version of supplied patch. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 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.