Skip to content

slab: provide and use krealloc_array()

Bartosz Golaszewski alsa-devel dri-devel kvm linux-edac linux-gpio linux-media linux-mm lkml netdev virtualization 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest9 patches 1 replyIn review 8 of 9 applied
  2. v28 patches 6 repliesSuperseded
  3. v18 patches 14 repliesSuperseded

Changes in v3 from the cover letter

- add a patch improving krealloc()'s kerneldoc
- fix a typo
- improve .rst doc
- tweak line breaks

Patches in v3 8 of 9 applied

#Subject and filesSizeRepliesApplied
1/9mm: slab: clarify krealloc()'s behavior with __GFP_ZEROmm/slab_common.c+3 -30 replies
2/9mm: slab: provide krealloc_array()Documentation/core-api/memory-allocation.rst include/linux/slab.h+22 -00 repliesApplied
3/9ALSA: pcm: use krealloc_array()sound/core/pcm_lib.c+2 -20 repliesApplied
4/9vhost: vringh: use krealloc_array()drivers/vhost/vringh.c+2 -10 repliesApplied
5/9pinctrl: use krealloc_array()drivers/pinctrl/pinctrl-utils.c+1 -11 replyApplied
6/9edac: ghes: use krealloc_array()drivers/edac/ghes_edac.c+2 -20 repliesApplied
7/9drm: atomic: use krealloc_array()drivers/gpu/drm/drm_atomic.c+2 -10 repliesApplied
8/9hwtracing: intel: use krealloc_array()drivers/hwtracing/intel_th/msu.c+1 -10 repliesApplied
9/9dma-buf: use krealloc_array()drivers/dma-buf/sync_file.c+1 -20 repliesApplied

Reviews trailers per patch

7 of 9 patches have a Reviewed-by or Acked-by.

PatchVlastimil BabkaTakashi IwaiMichael S. TsirkinAndy ShevchenkoBorislav PetkovDaniel VetterChristian KönigLinus Walleij
1/9
2/9A-b
3/9R-b
4/9A-b
5/9R-b R-b
6/9A-b
7/9A-b
8/9
9/9A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 8 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/9] slab: provide and use krealloc_array()

From: Bartosz Golaszewski <[email protected]>

Andy brought to my attention the fact that users allocating an array of equally sized elements should check if the size multiplication doesn't overflow. This is why we have helpers like kmalloc_array().

However we don't have krealloc_array() equivalent and there are many users who do their own multiplication when calling krealloc() for arrays.

This series provides krealloc_array() and uses it in a couple places.

A separate series will follow adding devm_krealloc_array() which is needed in the xilinx adc driver.

v1 -> v2:
- added a kernel doc for krealloc_array()
- mentioned krealloc et al in the docs
- collected review tags

v2 -> v3:
- add a patch improving krealloc()'s kerneldoc
- fix a typo
- improve .rst doc
- tweak line breaks

Bartosz Golaszewski (9):
mm: slab: clarify krealloc()'s behavior with __GFP_ZERO
mm: slab: provide krealloc_array()
ALSA: pcm: use krealloc_array()
vhost: vringh: use krealloc_array()
pinctrl: use krealloc_array()
edac: ghes: use krealloc_array()
drm: atomic: use krealloc_array()
hwtracing: intel: use krealloc_array()
dma-buf: use krealloc_array()

 Documentation/core-api/memory-allocation.rst |  4 ++++
 drivers/dma-buf/sync_file.c                  |  3 +--
 drivers/edac/ghes_edac.c                     |  4 ++--
 drivers/gpu/drm/drm_atomic.c                 |  3 ++-
 drivers/hwtracing/intel_th/msu.c             |  2 +-
 drivers/pinctrl/pinctrl-utils.c              |  2 +-
 drivers/vhost/vringh.c                       |  3 ++-
 include/linux/slab.h                         | 18 ++++++++++++++++++
 mm/slab_common.c                             |  6 +++---
 sound/core/pcm_lib.c                         |  4 ++--
 10 files changed, 36 insertions(+), 13 deletions(-)
Signature · 1 line
2.29.1