Skip to content

Commit

Permalink
btrfs: use kfree() in btrfs_ioctl_get_subvol_info()
Browse files Browse the repository at this point in the history
In btrfs_ioctl_get_subvol_info(), there is a classic case where kzalloc()
was incorrectly paired with kzfree(). According to David Sterba, there
isn't any sensitive information in the subvol_info that needs to be
cleared before freeing. So kzfree() isn't really needed, use kfree()
instead.

Signed-off-by: Waiman Long <longman@redhat.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Waiman Long authored and David Sterba committed Jun 16, 2020
1 parent 5dbb75e commit b091f7f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2692,7 +2692,7 @@ static int btrfs_ioctl_get_subvol_info(struct file *file, void __user *argp)
btrfs_put_root(root);
out_free:
btrfs_free_path(path);
kzfree(subvol_info);
kfree(subvol_info);
return ret;
}

Expand Down

0 comments on commit b091f7f

Please sign in to comment.