Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Oct 2000 10:17:52 -0400 (EDT)
From:      josh@zipperup.org
To:        FreeBSD-gnats-submit@freebsd.org
Cc:        dwmalone@freebsd.org
Subject:   kern/22188: Patch to sys/alpha to add M_ZERO to appropriate malloc calls
Message-ID:  <20001021141752.5923E3D1D@mail.snickers.org>

next in thread | raw e-mail | index | archive | help

>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:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 21 07:20:01 PDT 2000
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001021141752.5923E3D1D>