From josh@zipperup.org  Sat Oct 21 07:17:53 2000
Return-Path: <josh@zipperup.org>
Received: from mail.snickers.org (snickers.org [216.126.90.2])
	by hub.freebsd.org (Postfix) with ESMTP
	id 0FDAE37B479; Sat, 21 Oct 2000 07:17:53 -0700 (PDT)
Received: by mail.snickers.org (Postfix, from userid 1037)
	id 5923E3D1D; Sat, 21 Oct 2000 10:17:52 -0400 (EDT)
Message-Id: <20001021141752.5923E3D1D@mail.snickers.org>
Date: Sat, 21 Oct 2000 10:17:52 -0400 (EDT)
From: josh@zipperup.org
Reply-To: josh@zipperup.org
To: FreeBSD-gnats-submit@freebsd.org
Cc: dwmalone@freebsd.org
Subject: Patch to sys/alpha to add M_ZERO to appropriate malloc calls
X-Send-Pr-Version: 3.2

>Number:         22188
>Category:       kern
>Synopsis:       Patch to sys/alpha to add M_ZERO to appropriate malloc calls
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    dwmalone
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 21 07:20:01 PDT 2000
>Closed-Date:    Sun Dec 24 08:28:23 PST 2000
>Last-Modified:  Sun Dec 24 08:29:26 PST 2000
>Originator:     Josh Tiefenbach
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Connective Software
>Environment:

	-current circa 20 Oct 2000

>Description:

	Patch to convert malloc/bzero calls to malloc(..., M_ZERO) calls,
	as per phk's email to freebsd-current.

	Changes were made with the goal of keeping the semantics of the
	code the same in mind. If there was any doubt, then the change was
	not made.

	The patch compiles cleanly. Note, I dont have an alpha, so I'm not sure
   if everything is hunky-dory.

>How-To-Repeat:

	N/A

>Fix:
	
	Patch follows.

-------


Index: alpha/interrupt.c
===================================================================
RCS file: /usr/home/ncvs/src/sys/alpha/alpha/interrupt.c,v
retrieving revision 1.24
diff -u -r1.24 interrupt.c
--- alpha/interrupt.c	2000/10/05 23:09:42	1.24
+++ alpha/interrupt.c	2000/10/21 14:11:26
@@ -371,11 +371,10 @@
 	if (ithd == NULL || ithd->it_ih == NULL) {
 		/* first handler for this vector */
 		if (ithd == NULL) {
-			ithd = malloc(sizeof(struct ithd), M_DEVBUF, M_WAITOK);
+			ithd = malloc(sizeof(struct ithd), M_DEVBUF, M_WAITOK | M_ZERO);
 			if (ithd == NULL)
 				return ENOMEM;
 
-			bzero(ithd, sizeof(struct ithd));
 			ithd->irq = vector;
 			ithd->it_md = i;
 			i->ithd = ithd;
@@ -410,10 +409,9 @@
 	}
 
 	/* Third, setup the interrupt descriptor for this handler. */
-	idesc = malloc(sizeof (struct intrec), M_DEVBUF, M_WAITOK);
+	idesc = malloc(sizeof (struct intrec), M_DEVBUF, M_WAITOK | M_ZERO);
 	if (idesc == NULL)
 		return ENOMEM;
-	bzero(idesc, sizeof(struct intrec));
 
 	idesc->handler = handler;
 	idesc->argument = arg;
Index: osf1/imgact_osf1.c
===================================================================
RCS file: /usr/home/ncvs/src/sys/alpha/osf1/imgact_osf1.c,v
retrieving revision 1.1
diff -u -r1.1 imgact_osf1.c
--- osf1/imgact_osf1.c	1999/12/14 22:35:32	1.1
+++ osf1/imgact_osf1.c	2000/10/21 14:12:02
@@ -109,8 +109,7 @@
 		printf("unknown ecoff magic %x\n", eap->magic);
 		return ENOEXEC;
 	}
-	osf_auxargs = malloc(sizeof(Osf_Auxargs), M_TEMP, M_WAITOK);
-	bzero(osf_auxargs, sizeof(Osf_Auxargs));
+	osf_auxargs = malloc(sizeof(Osf_Auxargs), M_TEMP, M_WAITOK | M_ZERO);
 	imgp->auxargs = osf_auxargs;
 	osf_auxargs->executable = osf_auxargs->exec_path;
 	path_not_saved = copyinstr(imgp->fname, osf_auxargs->executable,
@@ -226,8 +225,7 @@
 	raw_dend = (eap->data_start + eap->dsize);
 	if (dend > raw_dend) {
 		caddr_t zeros;
-		zeros = malloc(dend-raw_dend,M_TEMP,M_WAITOK);
-		bzero(zeros,dend-raw_dend);
+		zeros = malloc(dend-raw_dend,M_TEMP,M_WAITOK|M_ZERO);
 		if ((error = copyout(zeros, (caddr_t)raw_dend,
 		    dend-raw_dend))) {
 			uprintf("Can't zero start of bss, error %d\n",error);


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->dwmalone 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Sat Oct 21 12:03:30 PDT 2000 
Responsible-Changed-Why:  
Josh - Can you check the parts of the system that Robert Drehmel 
has already produced patches for? I've merged all the patches I've 
recieved so far into one big patch at: 

http://www.maths.tcd.ie/~dwmalone/thirdtry 

I won't be able to apply all of this patch as some bits touch code 
from KAME or are shared by other BSDs. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=22188 

From: Matthew Jacob <mjacob@feral.com>
To: josh@zipperup.org
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, dwmalone@FreeBSD.ORG
Subject: Re: kern/22188: Patch to sys/alpha to add M_ZERO to appropriate
 malloc calls
Date: Fri, 27 Oct 2000 09:37:39 -0700 (PDT)

 I fixed the sys/alpha bits. Time to move on. Close the PR at your leisure.
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: dwmalone 
State-Changed-When: Sun Dec 24 08:28:23 PST 2000 
State-Changed-Why:  
Patches committed - thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22168 
State-Changed-From-To: open->closed 
State-Changed-By: dwmalone 
State-Changed-When: Sun Dec 24 08:28:23 PST 2000 
State-Changed-Why:  
Patches committed - thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22186 
State-Changed-From-To: open->closed 
State-Changed-By: dwmalone 
State-Changed-When: Sun Dec 24 08:28:23 PST 2000 
State-Changed-Why:  
Patches committed - thanks. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22188 
>Unformatted:
