Commit 64f0bd11 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Linus Torvalds
Browse files

ALSA: pcm: use krealloc_array()

Use the helper that checks for overflows internally instead of manually
calculating the size of the new array.


Signed-off-by: default avatarBartosz Golaszewski <>
Reviewed-by: default avatarTakashi Iwai <>
Cc: Alexander Shishkin <>
Cc: Andy Shevchenko <>
Cc: Borislav Petkov <>
Cc: Borislav Petkov <>
Cc: Christian Knig <>
Cc: Christoph Lameter <>
Cc: Daniel Vetter <>
Cc: Daniel Vetter <>
Cc: David Airlie <>
Cc: David Rientjes <>
Cc: Gustavo Padovan <>
Cc: James Morse <>
Cc: Jaroslav Kysela <>
Cc: Jason Wang <>
Cc: Joonsoo Kim <>
Cc: Linus Walleij <>
Cc: Maarten Lankhorst <>
Cc: Mauro Carvalho Chehab <>
Cc: Maxime Ripard <>
Cc: "Michael S . Tsirkin" <>
Cc: Pekka Enberg <>
Cc: Robert Richter <>
Cc: Sumit Semwal <>
Cc: Takashi Iwai <>
Cc: Thomas Zimmermann <>
Cc: Tony Luck <>
Cc: Vlastimil Babka <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent f0dbd2bd
......@@ -1129,8 +1129,8 @@ int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond,
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),
new = krealloc_array(constrs->rules, new_rules,
sizeof(*c), GFP_KERNEL);
if (!new) {
return -ENOMEM;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment