diff options
Diffstat (limited to 'drivers/md/raid1.c')
| -rw-r--r-- | drivers/md/raid1.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 0b344d087581..8e05c1092aef 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
| @@ -126,8 +126,8 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data) | |||
| 126 | if (!r1_bio) | 126 | if (!r1_bio) |
| 127 | return NULL; | 127 | return NULL; |
| 128 | 128 | ||
| 129 | rps = kmalloc(sizeof(struct resync_pages) * pi->raid_disks, | 129 | rps = kmalloc_array(pi->raid_disks, sizeof(struct resync_pages), |
| 130 | gfp_flags); | 130 | gfp_flags); |
| 131 | if (!rps) | 131 | if (!rps) |
| 132 | goto out_free_r1bio; | 132 | goto out_free_r1bio; |
| 133 | 133 | ||
| @@ -2936,9 +2936,9 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
| 2936 | if (!conf->barrier) | 2936 | if (!conf->barrier) |
| 2937 | goto abort; | 2937 | goto abort; |
| 2938 | 2938 | ||
| 2939 | conf->mirrors = kzalloc(sizeof(struct raid1_info) | 2939 | conf->mirrors = kzalloc(array3_size(sizeof(struct raid1_info), |
| 2940 | * mddev->raid_disks * 2, | 2940 | mddev->raid_disks, 2), |
| 2941 | GFP_KERNEL); | 2941 | GFP_KERNEL); |
| 2942 | if (!conf->mirrors) | 2942 | if (!conf->mirrors) |
| 2943 | goto abort; | 2943 | goto abort; |
| 2944 | 2944 | ||
| @@ -3241,7 +3241,8 @@ static int raid1_reshape(struct mddev *mddev) | |||
| 3241 | kfree(newpoolinfo); | 3241 | kfree(newpoolinfo); |
| 3242 | return ret; | 3242 | return ret; |
| 3243 | } | 3243 | } |
| 3244 | newmirrors = kzalloc(sizeof(struct raid1_info) * raid_disks * 2, | 3244 | newmirrors = kzalloc(array3_size(sizeof(struct raid1_info), |
| 3245 | raid_disks, 2), | ||
| 3245 | GFP_KERNEL); | 3246 | GFP_KERNEL); |
| 3246 | if (!newmirrors) { | 3247 | if (!newmirrors) { |
| 3247 | kfree(newpoolinfo); | 3248 | kfree(newpoolinfo); |
