From 1d5d37f408e530ce1eab1deb66d2331535665ec7 Mon Sep 17 00:00:00 2001 From: Thomas Meyer Date: Tue, 29 Nov 2011 22:08:00 +0100 Subject: [PATCH] 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 --- sound/pci/ctxfi/ctsrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.20.1