From owner-svn-src-stable-11@freebsd.org Mon Jun 4 05:23:07 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CFB1BFF2CEC; Mon, 4 Jun 2018 05:23:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B3E2727CA; Mon, 4 Jun 2018 05:23:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C68EF48; Mon, 4 Jun 2018 05:23:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w545N7tV075246; Mon, 4 Jun 2018 05:23:07 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w545N7vW075245; Mon, 4 Jun 2018 05:23:07 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201806040523.w545N7vW075245@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 4 Jun 2018 05:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r334603 - stable/11/usr.sbin/camdd X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/usr.sbin/camdd X-SVN-Commit-Revision: 334603 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2018 05:23:08 -0000 Author: delphij Date: Mon Jun 4 05:23:06 2018 New Revision: 334603 URL: https://svnweb.freebsd.org/changeset/base/334603 Log: MFC r332905: Use calloc() instead of malloc+bzero. Reviewed by: ken, emaste Modified: stable/11/usr.sbin/camdd/camdd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/camdd/camdd.c ============================================================================== --- stable/11/usr.sbin/camdd/camdd.c Mon Jun 4 05:04:40 2018 (r334602) +++ stable/11/usr.sbin/camdd/camdd.c Mon Jun 4 05:23:06 2018 (r334603) @@ -591,14 +591,12 @@ camdd_alloc_dev(camdd_dev_type dev_type, struct kevent size_t ke_size; int retval = 0; - dev = malloc(sizeof(*dev)); + dev = calloc(1, sizeof(*dev)); if (dev == NULL) { warn("%s: unable to malloc %zu bytes", __func__, sizeof(*dev)); goto bailout; } - bzero(dev, sizeof(*dev)); - dev->dev_type = dev_type; dev->io_timeout = timeout; dev->retry_count = retry_count; @@ -631,12 +629,11 @@ camdd_alloc_dev(camdd_dev_type dev_type, struct kevent } ke_size = sizeof(struct kevent) * (num_ke + 4); - ke = malloc(ke_size); + ke = calloc(1, ke_size); if (ke == NULL) { warn("%s: unable to malloc %zu bytes", __func__, ke_size); goto bailout; } - bzero(ke, ke_size); if (num_ke > 0) bcopy(new_ke, ke, num_ke * sizeof(struct kevent)); @@ -683,13 +680,12 @@ camdd_alloc_buf(struct camdd_dev *dev, camdd_buf_type break; } - buf = malloc(sizeof(*buf)); + buf = calloc(1, sizeof(*buf)); if (buf == NULL) { warn("unable to allocate %zu bytes", sizeof(*buf)); goto bailout_error; } - bzero(buf, sizeof(*buf)); buf->buf_type = buf_type; buf->dev = dev; switch (buf_type) {