Date: Sun, 5 Jul 1998 00:52:30 -0700 (PDT) From: Julian Elischer <julian@whistle.com> To: Greg Lehey <grog@lemis.com> Cc: Bruce Evans <bde@zeta.org.au>, cvs-committers@FreeBSD.ORG, julian@FreeBSD.ORG Subject: Re: Don't malloc buf headers (was: cvs commit: src/sys/dev/vn vn.c) Message-ID: <Pine.BSF.3.95.980705005141.10736A-100000@current1.whistle.com> In-Reply-To: <19980705143540.B18970@freebie.lemis.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 5 Jul 1998, Greg Lehey wrote: > On Saturday, 4 July 1998 at 18:41:17 +1000, Bruce Evans wrote: > >> Modified files: > >> sys/dev/vn vn.c > >> Log: > >> Don't use a struct buf (malloc'd) without first initialising all the fields > >> to some known value! > >> (probable cause of soft updates exploding with vn devices) > > > > Buffers should never be malloced. > > This is a problem that has been concerning me for a while, and one > that we have discussed before. In vinum, I need a buffer structure > with some pointers to other structures internal to vinum. We've > already agreed that b_driver1 and b_driver2 aren't the way to go > (though I notice that they're still present). My solution, stolen > from ccd, has been to malloc my own super-bufs with additional fields > at the end. If this isn't kosher, what method should I use? > > > There is no way of knowing how to initialize new fields like b_dep. > > Well, I've just checked through the code, and I can see how to > initialize it (for example, LIST_INIT(&cbp->cb_buf.b_dep) in ccd, in > conjunction with a malloced buffer :-), but I can't see it being used. > I can't find anywhere in the sources where it is actually more than > initialized. I also can't remember seeing anything about it in the > commit messages, and the CVS log for buf.h doesn't mention it. If I > read the diffs right, it appears to have come from the softupdates > code. What's it for? Should I worry in the vinum code, where the > buffers are all internal and have no file system connections? It's used in soft updates.. that's where all the dependencies are hung. > > Greg > -- > See complete headers for address and phone numbers > finger grog@lemis.com for PGP public key > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.980705005141.10736A-100000>