mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-02 18:54:10 +08:00
btrfs: switch to kcalloc in btrfs_cmp_data_prepare
Kcalloc is functionally equivalent and does overflow checks. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
fd95ef56b1
commit
66722f7c05
@ -2925,8 +2925,8 @@ static int btrfs_cmp_data_prepare(struct inode *src, u64 loff,
|
|||||||
* of the array is bounded by len, which is in turn bounded by
|
* of the array is bounded by len, which is in turn bounded by
|
||||||
* BTRFS_MAX_DEDUPE_LEN.
|
* BTRFS_MAX_DEDUPE_LEN.
|
||||||
*/
|
*/
|
||||||
src_pgarr = kzalloc(num_pages * sizeof(struct page *), GFP_KERNEL);
|
src_pgarr = kcalloc(num_pages, sizeof(struct page *), GFP_KERNEL);
|
||||||
dst_pgarr = kzalloc(num_pages * sizeof(struct page *), GFP_KERNEL);
|
dst_pgarr = kcalloc(num_pages, sizeof(struct page *), GFP_KERNEL);
|
||||||
if (!src_pgarr || !dst_pgarr) {
|
if (!src_pgarr || !dst_pgarr) {
|
||||||
kfree(src_pgarr);
|
kfree(src_pgarr);
|
||||||
kfree(dst_pgarr);
|
kfree(dst_pgarr);
|
||||||
|
Loading…
Reference in New Issue
Block a user