From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC0A83FC1 for ; Tue, 24 Aug 2021 18:37:28 +0000 (UTC) Received: by mail-lj1-f171.google.com with SMTP id w4so37769582ljh.13 for ; Tue, 24 Aug 2021 11:37:28 -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=gFsJKfS9ug3vI9Yk3/qdv2qYBDtrSy662nmOAGHYkqU=; b=IqZWAn/Xx6vV3cy2qy2Q6Do3I0oamzhZYncY9aLSK9O7/Zvyt2ZtQnjEWFGLHg2FVX kzDCeyp91cJ7U8Emjz5/OVTZKL6GUqVkasEVjxMzxiKXStlRKYI5HnbwhDGfCS+SehAU wLiR97bPt+OuQqlumab6F+/7vJCXFHjBvAv2CBgYLtdiylPZd6hUgvv1Ayqs7naFbKbH mVQu6uCiMwtFTRfLLin3X4awmi3bS1benkJAbEFrJ8dkSmfPu73zmZ/CXWxO2DR74ywO cHVsZeja6xHKGPm+qn/4l9HyqDLYOZ/LF2S0BMwkDgwv8isOwoob+MKa7iJACyIw8lXc vjZQ== 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=gFsJKfS9ug3vI9Yk3/qdv2qYBDtrSy662nmOAGHYkqU=; b=cskq6xB505WqI9GZIMMqZcQv4Yem/kutV0BttsIMQBuFnmEIb6/N0OlilLRtoFfT/s jU+4eDnNMZTeSJI/gkqn89DbPH6ceISLkd7JaU89KpSxWwZtXQofp7pKBuk8fqwf2NyB Gl5LjYFt52Wpnb1VlFs8inq9Yu6Tzz2kc5hCEO7VjhsacQf5lWlkEGYrENLKOwR991ba 2fDT/jWbNUdEX7pkJGuczxi/zSoK9cLQoHtaDT27GRGuNGMi12wjtio8UD4NQ9wmatFL h83Vf7IP3JKWC1e5w9UzFdIMBL3Q430VRYKycfz55S/jTWfSHrP89o22gB3Kk3SaAxVT b11w== X-Gm-Message-State: AOAM532/t10F9WDsFQGUHyBMB5EPlhsMDDG6kTES3BP2r3DZIMP4wJWK 1Dvq94CP+AdD2NlDImDF9SY= X-Google-Smtp-Source: ABdhPJxccGQuLlIrOIzyho2DWsW3xFYeN0fW912aWAWzeVxOtAgbnpMMkUo4jTLJRSvM37QTGGWQ+w== X-Received: by 2002:a2e:93c3:: with SMTP id p3mr26899838ljh.226.1629830246907; Tue, 24 Aug 2021 11:37:26 -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 k13sm1826378lfm.168.2021.08.24.11.37.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 11:37:26 -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 v4 3/3] fs/ntfs3: Use kcalloc/kmalloc_array over kzalloc/kmalloc Date: Tue, 24 Aug 2021 21:37:08 +0300 Message-Id: <20210824183708.1008538-4-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210824183708.1008538-1-kari.argillander@gmail.com> References: <20210824183708.1008538-1-kari.argillander@gmail.com> Precedence: bulk X-Mailing-List: ntfs3@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use kcalloc/kmalloc_array over kzalloc/kmalloc when we allocate array. Checkpatch found these after we did not use our own defined allocation wrappers. Reviewed-by: Christoph Hellwig 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..a959f6197c99 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 bbe03eebf798..321edf272cde 100644 --- a/fs/ntfs3/frecord.c +++ b/fs/ntfs3/frecord.c @@ -2054,7 +2054,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; @@ -2137,7 +2137,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; @@ -2709,8 +2709,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