Commit 1d5d37f408e530ce1eab1deb66d2331535665ec7

Authored by Thomas Meyer
Committed by Takashi Iwai
1 parent 705978516f

ALSA: ctxf: Use kcalloc instead of kzalloc to allocate array

The advantage of kcalloc is, that will prevent integer overflows which could
result from the multiplication of number of elements and size and it is also
a bit nicer to read.

The semantic patch that makes this change is available
in https://lkml.org/lkml/2011/11/25/107

Signed-off-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

sound/pci/ctxfi/ctsrc.c
... ... @@ -437,7 +437,7 @@
437 437  
438 438 /* Allocate mem for master src resource */
439 439 if (MEMRD == desc->mode)
440   - src = kzalloc(sizeof(*src)*desc->multi, GFP_KERNEL);
  440 + src = kcalloc(desc->multi, sizeof(*src), GFP_KERNEL);
441 441 else
442 442 src = kzalloc(sizeof(*src), GFP_KERNEL);
443 443