The patch titled Subject: ALSA: pcm: use krealloc_array() has been added to the -mm tree. Its filename is alsa-pcm-use-krealloc_array.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/alsa-pcm-use-krealloc_array.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/alsa-pcm-use-krealloc_array.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx> Subject: ALSA: pcm: use krealloc_array() Use the helper that checks for overflows internally instead of manually calculating the size of the new array. Link: https://lkml.kernel.org/r/20201109110654.12547-4-brgl@xxxxxxxx Signed-off-by: Bartosz Golaszewski <bgolaszewski@xxxxxxxxxxxx> Reviewed-by: Takashi Iwai <tiwai@xxxxxxx> Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx> Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxxxx> Cc: Borislav Petkov <bp@xxxxxxx> Cc: Christian Knig <christian.koenig@xxxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxx> Cc: Daniel Vetter <daniel@xxxxxxxx> Cc: Daniel Vetter <daniel.vetter@xxxxxxxx> Cc: David Airlie <airlied@xxxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Cc: Gustavo Padovan <gustavo@xxxxxxxxxxx> Cc: James Morse <james.morse@xxxxxxx> Cc: Jaroslav Kysela <perex@xxxxxxxx> Cc: Jason Wang <jasowang@xxxxxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Cc: Linus Walleij <linus.walleij@xxxxxxxxxx> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx> Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx> Cc: Maxime Ripard <mripard@xxxxxxxxxx> Cc: "Michael S . Tsirkin" <mst@xxxxxxxxxx> Cc: Pekka Enberg <penberg@xxxxxxxxxx> Cc: Robert Richter <rric@xxxxxxxxxx> Cc: Sumit Semwal <sumit.semwal@xxxxxxxxxx> Cc: Takashi Iwai <tiwai@xxxxxxxx> Cc: Thomas Zimmermann <tzimmermann@xxxxxxx> Cc: Tony Luck <tony.luck@xxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- sound/core/pcm_lib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/sound/core/pcm_lib.c~alsa-pcm-use-krealloc_array +++ a/sound/core/pcm_lib.c @@ -1129,8 +1129,8 @@ int snd_pcm_hw_rule_add(struct snd_pcm_r if (constrs->rules_num >= constrs->rules_all) { struct snd_pcm_hw_rule *new; unsigned int new_rules = constrs->rules_all + 16; - new = krealloc(constrs->rules, new_rules * sizeof(*c), - GFP_KERNEL); + new = krealloc_array(constrs->rules, new_rules, + sizeof(*c), GFP_KERNEL); if (!new) { va_end(args); return -ENOMEM; _ Patches currently in -mm which might be from bgolaszewski@xxxxxxxxxxxx are mm-slab-clarify-kreallocs-behavior-with-__gfp_zero.patch mm-slab-provide-krealloc_array.patch alsa-pcm-use-krealloc_array.patch vhost-vringh-use-krealloc_array.patch pinctrl-use-krealloc_array.patch edac-ghes-use-krealloc_array.patch drm-atomic-use-krealloc_array.patch hwtracing-intel-use-krealloc_array.patch dma-buf-use-krealloc_array.patch