]> Git Repo - linux.git/commitdiff
ALSA: pcm: use krealloc_array()
authorBartosz Golaszewski <[email protected]>
Tue, 15 Dec 2020 03:03:59 +0000 (19:03 -0800)
committerLinus Torvalds <[email protected]>
Tue, 15 Dec 2020 20:13:37 +0000 (12:13 -0800)
Use the helper that checks for overflows internally instead of manually
calculating the size of the new array.

Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Takashi Iwai <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andy Shevchenko <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Christian Knig <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: David Airlie <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Gustavo Padovan <[email protected]>
Cc: James Morse <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Jason Wang <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Linus Walleij <[email protected]>
Cc: Maarten Lankhorst <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: "Michael S . Tsirkin" <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Robert Richter <[email protected]>
Cc: Sumit Semwal <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
sound/core/pcm_lib.c

index bda3514c7b2d91e8974005ad88c66150af6c47c6..b7e3d8f445113cc032b617445a302bfed2c55901 100644 (file)
@@ -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),
-                              GFP_KERNEL);
+               new = krealloc_array(constrs->rules, new_rules,
+                                    sizeof(*c), GFP_KERNEL);
                if (!new) {
                        va_end(args);
                        return -ENOMEM;
This page took 0.056341 seconds and 4 git commands to generate.