diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-12 21:28:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-12 21:28:00 -0400 |
commit | b08fc5277aaa1d8ea15470d38bf36f19dfb0e125 (patch) | |
tree | 1910dc474cb1ede95581dd9faa81a3bebeded0dc /drivers/lightnvm/pblk-init.c | |
parent | 4597fcff07044d89c646d0c5d8b42cd976d966a1 (diff) | |
parent | 9d2a789c1db75d0f55b14fa57bec548d94332ad8 (diff) |
Merge tag 'overflow-v4.18-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux
Pull more overflow updates from Kees Cook:
"The rest of the overflow changes for v4.18-rc1.
This includes the explicit overflow fixes from Silvio, further
struct_size() conversions from Matthew, and a bug fix from Dan.
But the bulk of it is the treewide conversions to use either the
2-factor argument allocators (e.g. kmalloc(a * b, ...) into
kmalloc_array(a, b, ...) or the array_size() macros (e.g. vmalloc(a *
b) into vmalloc(array_size(a, b)).
Coccinelle was fighting me on several fronts, so I've done a bunch of
manual whitespace updates in the patches as well.
Summary:
- Error path bug fix for overflow tests (Dan)
- Additional struct_size() conversions (Matthew, Kees)
- Explicitly reported overflow fixes (Silvio, Kees)
- Add missing kvcalloc() function (Kees)
- Treewide conversions of allocators to use either 2-factor argument
variant when available, or array_size() and array3_size() as needed
(Kees)"
* tag 'overflow-v4.18-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: (26 commits)
treewide: Use array_size in f2fs_kvzalloc()
treewide: Use array_size() in f2fs_kzalloc()
treewide: Use array_size() in f2fs_kmalloc()
treewide: Use array_size() in sock_kmalloc()
treewide: Use array_size() in kvzalloc_node()
treewide: Use array_size() in vzalloc_node()
treewide: Use array_size() in vzalloc()
treewide: Use array_size() in vmalloc()
treewide: devm_kzalloc() -> devm_kcalloc()
treewide: devm_kmalloc() -> devm_kmalloc_array()
treewide: kvzalloc() -> kvcalloc()
treewide: kvmalloc() -> kvmalloc_array()
treewide: kzalloc_node() -> kcalloc_node()
treewide: kzalloc() -> kcalloc()
treewide: kmalloc() -> kmalloc_array()
mm: Introduce kvcalloc()
video: uvesafb: Fix integer overflow in allocation
UBIFS: Fix potential integer overflow in allocation
leds: Use struct_size() in allocation
Convert intel uncore to struct_size
...
Diffstat (limited to 'drivers/lightnvm/pblk-init.c')
-rw-r--r-- | drivers/lightnvm/pblk-init.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 491df0fa0835..b57f764d6a16 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c | |||
@@ -187,7 +187,7 @@ static int pblk_rwb_init(struct pblk *pblk) | |||
187 | 187 | ||
188 | nr_entries = pblk_rb_calculate_size(buffer_size); | 188 | nr_entries = pblk_rb_calculate_size(buffer_size); |
189 | 189 | ||
190 | entries = vzalloc(nr_entries * sizeof(struct pblk_rb_entry)); | 190 | entries = vzalloc(array_size(nr_entries, sizeof(struct pblk_rb_entry))); |
191 | if (!entries) | 191 | if (!entries) |
192 | return -ENOMEM; | 192 | return -ENOMEM; |
193 | 193 | ||
@@ -379,7 +379,7 @@ static int pblk_core_init(struct pblk *pblk) | |||
379 | return -EINVAL; | 379 | return -EINVAL; |
380 | } | 380 | } |
381 | 381 | ||
382 | pblk->pad_dist = kzalloc((pblk->min_write_pgs - 1) * sizeof(atomic64_t), | 382 | pblk->pad_dist = kcalloc(pblk->min_write_pgs - 1, sizeof(atomic64_t), |
383 | GFP_KERNEL); | 383 | GFP_KERNEL); |
384 | if (!pblk->pad_dist) | 384 | if (!pblk->pad_dist) |
385 | return -ENOMEM; | 385 | return -ENOMEM; |
@@ -833,8 +833,8 @@ static int pblk_alloc_line_meta(struct pblk *pblk, struct pblk_line *line) | |||
833 | goto free_blk_bitmap; | 833 | goto free_blk_bitmap; |
834 | 834 | ||
835 | 835 | ||
836 | line->chks = kmalloc(lm->blk_per_line * sizeof(struct nvm_chk_meta), | 836 | line->chks = kmalloc_array(lm->blk_per_line, |
837 | GFP_KERNEL); | 837 | sizeof(struct nvm_chk_meta), GFP_KERNEL); |
838 | if (!line->chks) | 838 | if (!line->chks) |
839 | goto free_erase_bitmap; | 839 | goto free_erase_bitmap; |
840 | 840 | ||