From owner-freebsd-bugs Sat Oct 21 7:10:14 2000 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id D314D37B4E5 for ; Sat, 21 Oct 2000 07:10:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id HAA73358; Sat, 21 Oct 2000 07:10:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from mail.snickers.org (snickers.org [216.126.90.2]) by hub.freebsd.org (Postfix) with ESMTP id D903D37B479; Sat, 21 Oct 2000 07:08:59 -0700 (PDT) Received: by mail.snickers.org (Postfix, from userid 1037) id DF9503D1D; Sat, 21 Oct 2000 10:08:58 -0400 (EDT) Message-Id: <20001021140858.DF9503D1D@mail.snickers.org> Date: Sat, 21 Oct 2000 10:08:58 -0400 (EDT) From: josh@zipperup.org Reply-To: josh@zipperup.org To: FreeBSD-gnats-submit@freebsd.org Cc: dwmalone@freebsd.org, gibbs@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/22186: Patch to sys/cam to add M_ZERO to appropriate malloc calls Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 22186 >Category: kern >Synopsis: Patch to sys/cam 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:10: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, and appears to have had no ill effects. >How-To-Repeat: N/A >Fix: Patch follows. ----- Index: scsi/scsi_cd.c =================================================================== RCS file: /usr/home/ncvs/src/sys/cam/scsi/scsi_cd.c,v retrieving revision 1.39 diff -u -r1.39 scsi_cd.c --- scsi/scsi_cd.c 2000/05/26 02:01:48 1.39 +++ scsi/scsi_cd.c 2000/10/21 14:00:44 @@ -3026,8 +3026,7 @@ } if (length != 0) { - databuf = malloc(length, M_DEVBUF, M_WAITOK); - bzero(databuf, length); + databuf = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); } else databuf = NULL; @@ -3158,12 +3157,10 @@ length = sizeof(*challenge_data); - challenge_data = malloc(length, M_DEVBUF, M_WAITOK); + challenge_data = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); databuf = (u_int8_t *)challenge_data; - bzero(databuf, length); - scsi_ulto2b(length - sizeof(challenge_data->data_len), challenge_data->data_len); @@ -3177,12 +3174,10 @@ length = sizeof(*key2_data); - key2_data = malloc(length, M_DEVBUF, M_WAITOK); + key2_data = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); databuf = (u_int8_t *)key2_data; - bzero(databuf, length); - scsi_ulto2b(length - sizeof(key2_data->data_len), key2_data->data_len); @@ -3196,12 +3191,10 @@ length = sizeof(*rpc_data); - rpc_data = malloc(length, M_DEVBUF, M_WAITOK); + rpc_data = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); databuf = (u_int8_t *)rpc_data; - bzero(databuf, length); - scsi_ulto2b(length - sizeof(rpc_data->data_len), rpc_data->data_len); @@ -3343,8 +3336,7 @@ } if (length != 0) { - databuf = malloc(length, M_DEVBUF, M_WAITOK); - bzero(databuf, length); + databuf = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); } else databuf = NULL; Index: scsi/scsi_ch.c =================================================================== RCS file: /usr/home/ncvs/src/sys/cam/scsi/scsi_ch.c,v retrieving revision 1.22 diff -u -r1.22 scsi_ch.c --- scsi/scsi_ch.c 2000/04/18 15:14:52 1.22 +++ scsi/scsi_ch.c 2000/10/21 14:01:13 @@ -1192,8 +1192,7 @@ user_data = (struct changer_element_status *) malloc(avail * sizeof(struct changer_element_status), - M_DEVBUF, M_WAITOK); - bzero(user_data, avail * sizeof(struct changer_element_status)); + M_DEVBUF, M_WAITOK | M_ZERO); desc = (struct read_element_status_descriptor *)((uintptr_t)data + sizeof(struct read_element_status_header) + Index: scsi/scsi_sa.c =================================================================== RCS file: /usr/home/ncvs/src/sys/cam/scsi/scsi_sa.c,v retrieving revision 1.57 diff -u -r1.57 scsi_sa.c --- scsi/scsi_sa.c 2000/10/05 17:02:20 1.57 +++ scsi/scsi_sa.c 2000/10/21 14:01:56 @@ -2392,8 +2392,7 @@ mode_buffer_len += sizeof (sa_comp_t); } - mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK); - bzero(mode_buffer, mode_buffer_len); + mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK | M_ZERO); mode_hdr = (struct scsi_mode_header_6 *)mode_buffer; mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1]; @@ -2595,8 +2594,7 @@ if (params_to_set & SA_PARAM_COMPRESSION) mode_buffer_len += sizeof (sa_comp_t); - mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK); - bzero(mode_buffer, mode_buffer_len); + mode_buffer = malloc(mode_buffer_len, M_TEMP, M_WAITOK | M_ZERO); mode_hdr = (struct scsi_mode_header_6 *)mode_buffer; mode_blk = (struct scsi_mode_blk_desc *)&mode_hdr[1]; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message