Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp26828pxb; Tue, 17 Aug 2021 18:11:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJsGTQbJ3h5CCboGHDauX2jYymcx6/Xefqt3icBXzD3K9j0LByjCKPEIC4XyrvGJvmnSqz X-Received: by 2002:a17:906:4a48:: with SMTP id a8mr6891702ejv.524.1629249119529; Tue, 17 Aug 2021 18:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629249119; cv=none; d=google.com; s=arc-20160816; b=SXOZ7kJapAGcDJLIqlat5QSEPkx8/eh6Fs0URVIQ8h22lfEBCiKhsihFR323Mp5w8E 3d/BTDDMdLVfpcXLhd7E99CcWx47uX/vCvs8eFzp1D1AtEQczjfXQJq782sILGm9c+ov wTCrn0XIB/xv2Bnd0vF9m3xNhzObSKXftudlpk6ZA+IyBlQRv5P5vUp/FSwzMGpqro4I WafVucx2lj+SQu9ffPJRL6HOJxLCesxCCp+4clXmBoYCX2OARElwWKiTEbDz3F2jDSHV tydcD4uehDefRKxvW4Rk0FPzt/sHpyTLAEl2x5dwOoWADhHuHoFdR4iUvgM3JK6ya5xn iIZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tMEOQb478MirVZ4PNVB8KP4GAWyRowJiqiV9ITepmh8=; b=FxMqKVWSy1vdi9HW4AJeUeQM1CkKzIDnjjv1hZ/jFbQeUddDHU3NMJs4nBuaWKFOgO pV76ZwSzQVOrSsqi4N3Xk/eSfV+/WZZk+rIlhzCHVz5wB8R3dwLeX4AnU6M/9/AlUuVG skxuAPAg9B6QJNMRHP5vuKcIBcccLRZmeziWyH4bnq7y5fbL3OM5vLAinuNrCX7A5A26 XHVu7ElsfZfQEfLr3Sv5sWpe1R9TnH8Jd+3+lVxEF8M77lXtNcDgYRHVN6QOnjfqQwg+ Nxz3TlXcagYIyraiqXMmFcz+wQKn5IaHVKl1gPtUfr8n73/q7rjEwA0+W5kTbR5j6sNC UOHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="a/mKBpuC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si4714357eds.112.2021.08.17.18.11.35; Tue, 17 Aug 2021 18:11:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="a/mKBpuC"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237441AbhHRBIA (ORCPT + 99 others); Tue, 17 Aug 2021 21:08:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236061AbhHRBHu (ORCPT ); Tue, 17 Aug 2021 21:07:50 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B148C0613CF for ; Tue, 17 Aug 2021 18:07:16 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id q21so1941163ljj.6 for ; Tue, 17 Aug 2021 18:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tMEOQb478MirVZ4PNVB8KP4GAWyRowJiqiV9ITepmh8=; b=a/mKBpuC+uzUwqMhGIIeCuzlyvBxzuKUtXdHFRJmcEaV0BpWRusszfsY1ZsH9LJCwn QCVjz+Yk2SBz/V9YWMprKbPXMoF4fwWIx8rGLGKTN2kj1gj5tJj9B1ijlmb17Rtyy2Lp OQJZVfCdH1/C5zJQkp7nWYAGW7Opc87+USiRqGDKo9pXXrtnt7pYKOGEO4WvAiVjJQJ/ VN7OZ/C3URaacU7DVAnpsq8VD+iR0Rb+Oa89FDKXyn8WUKo8jBVAZhMq/jgV5Rn0xN44 qRWO7ih5s9d0FUYwh1bZpz7UgYUsclvz+mt+FNw/jLW6ELm6JieCIOYv1K44FDlqJh9h V2dQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tMEOQb478MirVZ4PNVB8KP4GAWyRowJiqiV9ITepmh8=; b=bhUbkpGfFVZdnLPIdUK0uFRr060R/66BSWmpQ9vSdKe6suoVunoq9QbhGe2jxdTEJd K+H0YS3xgKXGHNnvltCJXqcP18pFIJvb/2pQNJpGSW9rqSXODeUhnyjWC/Fzj6zGozEV rxHBPCx15OvykhYh/p/8m4qxiqECXCKE5jazFKpQL2NokB6onN61uB3AKjfSudKTPoa3 9gfoUvYC9JLcaXNugJHisHMOQZEGAyzfKRCPZNQDetkSvebV/xx0Z/nzTPUXi5qO8TX+ fi3G3HcWuPAjIAp6wbOYV7HC5WMTxyM1/r5RKHU20Ka7dTYZYqcENBEu0n+jauqHEuiG t5CQ== X-Gm-Message-State: AOAM533ntJRnwqgR+uMdH4G9L3Oi4zLRofBb3tMYe+Vd1kwUO5Jnpp86 9sMqZMqV4UlHnpg6Kdx/VG4= X-Received: by 2002:a2e:bb8f:: with SMTP id y15mr5524661lje.148.1629248834555; Tue, 17 Aug 2021 18:07:14 -0700 (PDT) Received: from kari-VirtualBox.telewell.oy (85-23-89-224.bb.dnainternet.fi. [85.23.89.224]) by smtp.gmail.com with ESMTPSA id j4sm400245ljh.120.2021.08.17.18.07.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 18:07:14 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev, Christoph Hellwig Cc: Kari Argillander , linux-kernel@vger.kernel.org, Joe Perches Subject: [PATCH v3 3/3] fs/ntfs3: Use kcalloc/kmalloc_array over kzalloc/kmalloc Date: Wed, 18 Aug 2021 04:06:49 +0300 Message-Id: <20210818010649.412912-4-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210818010649.412912-1-kari.argillander@gmail.com> References: <20210818010649.412912-1-kari.argillander@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use kcalloc/kmalloc_array over kzalloc/kmalloc when we allocate array. Checkpatch found these after we did not use our own defined allocation wrappers. Signed-off-by: Kari Argillander --- fs/ntfs3/bitmap.c | 2 +- fs/ntfs3/file.c | 2 +- fs/ntfs3/frecord.c | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c index d502bba323d0..2de05062c78b 100644 --- a/fs/ntfs3/bitmap.c +++ b/fs/ntfs3/bitmap.c @@ -683,7 +683,7 @@ int wnd_init(struct wnd_bitmap *wnd, struct super_block *sb, size_t nbits) if (!wnd->bits_last) wnd->bits_last = wbits; - wnd->free_bits = kzalloc(wnd->nwnd * sizeof(u16), GFP_NOFS); + wnd->free_bits = kcalloc(wnd->nwnd, sizeof(u16), GFP_NOFS); if (!wnd->free_bits) return -ENOMEM; diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index 8d27c520bec5..6687f3c67450 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -900,7 +900,7 @@ static ssize_t ntfs_compress_write(struct kiocb *iocb, struct iov_iter *from) return -EOPNOTSUPP; } - pages = kmalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS); + pages = kmalloc_array(pages_per_frame, sizeof(struct page *), GFP_NOFS); if (!pages) return -ENOMEM; diff --git a/fs/ntfs3/frecord.c b/fs/ntfs3/frecord.c index 33c6b40d8ca7..98bca9f9d8d1 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -2050,7 +2050,7 @@ int ni_readpage_cmpr(struct ntfs_inode *ni, struct page *page) idx = (vbo - frame_vbo) >> PAGE_SHIFT; pages_per_frame = frame_size >> PAGE_SHIFT; - pages = kzalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS); + pages = kcalloc(pages_per_frame, sizeof(struct page *), GFP_NOFS); if (!pages) { err = -ENOMEM; goto out; @@ -2133,7 +2133,7 @@ int ni_decompress_file(struct ntfs_inode *ni) frame_bits = ni_ext_compress_bits(ni); frame_size = 1u << frame_bits; pages_per_frame = frame_size >> PAGE_SHIFT; - pages = kzalloc(pages_per_frame * sizeof(struct page *), GFP_NOFS); + pages = kcalloc(pages_per_frame, sizeof(struct page *), GFP_NOFS); if (!pages) { err = -ENOMEM; goto out; @@ -2705,8 +2705,7 @@ int ni_write_frame(struct ntfs_inode *ni, struct page **pages, goto out; } - pages_disk = kzalloc(pages_per_frame * sizeof(struct page *), - GFP_NOFS); + pages_disk = kcalloc(pages_per_frame, sizeof(struct page *), GFP_NOFS); if (!pages_disk) { err = -ENOMEM; goto out; -- 2.25.1