From: Thomas Meyer Date: Tue, 29 Nov 2011 21:08:00 +0000 (+0100) Subject: ALSA: ctxf: Use kcalloc instead of kzalloc to allocate array X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;ds=sidebyside;h=1d5d37f408e530ce1eab1deb66d2331535665ec7;p=linux-beck.git 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 Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c index e134b3a5780d..6e77e86307c2 100644 --- a/sound/pci/ctxfi/ctsrc.c +++ b/sound/pci/ctxfi/ctsrc.c @@ -437,7 +437,7 @@ get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc) /* Allocate mem for master src resource */ if (MEMRD == desc->mode) - src = kzalloc(sizeof(*src)*desc->multi, GFP_KERNEL); + src = kcalloc(desc->multi, sizeof(*src), GFP_KERNEL); else src = kzalloc(sizeof(*src), GFP_KERNEL);