diff options
author | Kees Cook <keescook@chromium.org> | 2018-10-06 01:21:46 +0200 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2018-10-06 03:06:30 +0200 |
commit | 329e09893909d409039f6a79757d9b80b67efe39 (patch) | |
tree | d83759b28dcc8760167ed7c082d5846f63a55d2d /drivers/md | |
parent | Linux 4.19-rc2 (diff) | |
download | linux-329e09893909d409039f6a79757d9b80b67efe39.tar.xz linux-329e09893909d409039f6a79757d9b80b67efe39.zip |
treewide: Replace more open-coded allocation size multiplications
As done treewide earlier, this catches several more open-coded
allocation size calculations that were added to the kernel during the
merge window. This performs the following mechanical transformations
using Coccinelle:
kvmalloc(a * b, ...) -> kvmalloc_array(a, b, ...)
kvzalloc(a * b, ...) -> kvcalloc(a, b, ...)
devm_kzalloc(..., a * b, ...) -> devm_kcalloc(..., a, b, ...)
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-integrity.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/dm-integrity.c b/drivers/md/dm-integrity.c index 378878599466..244ff5580f82 100644 --- a/drivers/md/dm-integrity.c +++ b/drivers/md/dm-integrity.c @@ -3462,7 +3462,8 @@ try_smaller_buffer: r = -ENOMEM; goto bad; } - ic->recalc_tags = kvmalloc((RECALC_SECTORS >> ic->sb->log2_sectors_per_block) * ic->tag_size, GFP_KERNEL); + ic->recalc_tags = kvmalloc_array(RECALC_SECTORS >> ic->sb->log2_sectors_per_block, + ic->tag_size, GFP_KERNEL); if (!ic->recalc_tags) { ti->error = "Cannot allocate tags for recalculating"; r = -ENOMEM; |