From patchwork Tue Sep 29 17:10:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "S. Fricke" X-Patchwork-Id: 7288741 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8A0FFBEEA4 for ; Tue, 29 Sep 2015 17:11:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CD3F020676 for ; Tue, 29 Sep 2015 17:11:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0851A205C7 for ; Tue, 29 Sep 2015 17:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935094AbbI2RL0 (ORCPT ); Tue, 29 Sep 2015 13:11:26 -0400 Received: from mail-wi0-f177.google.com ([209.85.212.177]:34037 "EHLO mail-wi0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932797AbbI2RLI (ORCPT ); Tue, 29 Sep 2015 13:11:08 -0400 Received: by wicfx3 with SMTP id fx3so160627507wic.1 for ; Tue, 29 Sep 2015 10:11:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=mTWpXbn88hO6wRHDvRBGZlnTIDw+F3Vwpp/QVyv6zOQ=; b=eoFIsr2u8w0INVqZRC58k37XyKlP9bGitqEqbJ/jL7aXUOypX57SWiIAA1R35JHQ7L NOzYUMDnylbFmbJhKvb41wNg43duNjaHuBf8d0MQK8JSvtL6Aj89+1gdSmCeGA7l6Iw5 3LVFjGftL+Ed9YvcPoGy7PZ59FjAyaPvzR/XG+KH02IHzxpKlgkWO4enLdBte0xUrZRK sO1FPXrgwv8O0t7F7qYyzzVfVXHBmrp1ORhOKXWjm6psUIbYw0Yln9bFHvS9dSe4ZxME G+XyfJp9nmul9vJg3FWm1nM51IVtRB6bebmn4cK9gl7Xz0tqMEw+XP5Ryw0daV37MQGk JzCA== X-Received: by 10.180.188.101 with SMTP id fz5mr28539804wic.3.1443546667595; Tue, 29 Sep 2015 10:11:07 -0700 (PDT) Received: from zwielicht.lan (ip5f5ba60a.dynamic.kabel-deutschland.de. [95.91.166.10]) by smtp.gmail.com with ESMTPSA id xt1sm24898618wjb.32.2015.09.29.10.11.05 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Sep 2015 10:11:06 -0700 (PDT) From: Silvio Fricke To: linux-btrfs@vger.kernel.org Cc: Silvio Fricke Subject: [PATCH 07/11] btrfs-progs: use calloc instead of malloc+memset for mkfs.c Date: Tue, 29 Sep 2015 19:10:42 +0200 Message-Id: X-Mailer: git-send-email 2.5.3 In-Reply-To: References: In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch is generated from a coccinelle semantic patch: identifier t; expression e; statement s; @@ -t = malloc(e); +t = calloc(1, e); ( if (!t) s | if (t == NULL) s | ) -memset(t, 0, e); Signed-off-by: Silvio Fricke --- mkfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mkfs.c b/mkfs.c index a5802f7..ecd6fbf 100644 --- a/mkfs.c +++ b/mkfs.c @@ -668,12 +668,11 @@ static int add_file_items(struct btrfs_trans_handle *trans, * do our IO in extent buffers so it can work * against any raid type */ - eb = malloc(sizeof(*eb) + sectorsize); + eb = calloc(1, sizeof(*eb) + sectorsize); if (!eb) { ret = -ENOMEM; goto end; } - memset(eb, 0, sizeof(*eb) + sectorsize); again: