Received: from eggs.gnu.org ([2001:4830:134:3::10]:40302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwWDH-0005EK-0W for qemu-devel@nongnu.org; Thu, 04 Dec 2014 08:13:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XwWDA-0001FD-SH for qemu-devel@nongnu.org; Thu, 04 Dec 2014 08:12:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51180) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwWDA-0001F3-Kf for qemu-devel@nongnu.org; Thu, 04 Dec 2014 08:12:48 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sB4DClkB031356 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 4 Dec 2014 08:12:48 -0500 From: Markus Armbruster Date: Thu, 4 Dec 2014 14:12:44 +0100 Message-Id: <1417698765-16311-3-git-send-email-armbru@redhat.com> In-Reply-To: <1417698765-16311-1-git-send-email-armbru@redhat.com> References: <1417698765-16311-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH 2/3] scsi: Fuse g_malloc(); memset() into g_malloc0() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com Coccinelle semantic patch: @@ expression LHS, SZ; @@ - LHS = g_malloc(SZ); - memset(LHS, 0, SZ); + LHS = g_malloc0(SZ); Signed-off-by: Markus Armbruster --- hw/scsi/megasas.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c index 604252a..4852237 100644 --- a/hw/scsi/megasas.c +++ b/hw/scsi/megasas.c @@ -1018,8 +1018,7 @@ static int megasas_pd_get_info_submit(SCSIDevice *sdev, int lun, size_t len, resid; if (!cmd->iov_buf) { - cmd->iov_buf = g_malloc(dcmd_size); - memset(cmd->iov_buf, 0, dcmd_size); + cmd->iov_buf = g_malloc0(dcmd_size); info = cmd->iov_buf; info->inquiry_data[0] = 0x7f; /* Force PQual 0x3, PType 0x1f */ info->vpd_page83[0] = 0x7f; @@ -1221,8 +1220,7 @@ static int megasas_ld_get_info_submit(SCSIDevice *sdev, int lun, uint64_t ld_size; if (!cmd->iov_buf) { - cmd->iov_buf = g_malloc(dcmd_size); - memset(cmd->iov_buf, 0x0, dcmd_size); + cmd->iov_buf = g_malloc0(dcmd_size); info = cmd->iov_buf; megasas_setup_inquiry(cdb, 0x83, sizeof(info->vpd_page83)); req = scsi_req_new(sdev, cmd->index, lun, cdb, cmd); -- 1.9.3