mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 01:10:04 +00:00
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs fix from Chris Mason: "I'm still testing more fixes, but I wanted to get out the fix for the btrfs raid5/6 memory corruption I mentioned in my merge window pull" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: Btrfs: fix allocation size calculations in alloc_btrfs_bio
This commit is contained in:
commit
7dac5cb1bc
1 changed files with 8 additions and 1 deletions
|
@ -4903,10 +4903,17 @@ static void sort_parity_stripes(struct btrfs_bio *bbio, int num_stripes)
|
||||||
static struct btrfs_bio *alloc_btrfs_bio(int total_stripes, int real_stripes)
|
static struct btrfs_bio *alloc_btrfs_bio(int total_stripes, int real_stripes)
|
||||||
{
|
{
|
||||||
struct btrfs_bio *bbio = kzalloc(
|
struct btrfs_bio *bbio = kzalloc(
|
||||||
|
/* the size of the btrfs_bio */
|
||||||
sizeof(struct btrfs_bio) +
|
sizeof(struct btrfs_bio) +
|
||||||
|
/* plus the variable array for the stripes */
|
||||||
sizeof(struct btrfs_bio_stripe) * (total_stripes) +
|
sizeof(struct btrfs_bio_stripe) * (total_stripes) +
|
||||||
|
/* plus the variable array for the tgt dev */
|
||||||
sizeof(int) * (real_stripes) +
|
sizeof(int) * (real_stripes) +
|
||||||
sizeof(u64) * (real_stripes),
|
/*
|
||||||
|
* plus the raid_map, which includes both the tgt dev
|
||||||
|
* and the stripes
|
||||||
|
*/
|
||||||
|
sizeof(u64) * (total_stripes),
|
||||||
GFP_NOFS);
|
GFP_NOFS);
|
||||||
if (!bbio)
|
if (!bbio)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue