Skip to content

Commit 520a563

Browse files
ethancedwards8tiwai
authored andcommitted
ALSA: ctxfi: change dao_set_input functions from kzalloc to kcalloc
We are trying to get rid of all multiplications from allocation functions to prevent potential integer overflows. Here the multiplication is probably safe, but using kcalloc() is more appropriate and improves readability. This patch has no effect on runtime behavior. Link: KSPP#162 [1] Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments Signed-off-by: Ethan Carter Edwards <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent ef749c8 commit 520a563

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sound/pci/ctxfi/ctdaio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ static int dao_set_left_input(struct dao *dao, struct rsc *input)
159159
struct daio *daio = &dao->daio;
160160
int i;
161161

162-
entry = kzalloc((sizeof(*entry) * daio->rscl.msr), GFP_KERNEL);
162+
entry = kcalloc(daio->rscl.msr, sizeof(*entry), GFP_KERNEL);
163163
if (!entry)
164164
return -ENOMEM;
165165

@@ -188,7 +188,7 @@ static int dao_set_right_input(struct dao *dao, struct rsc *input)
188188
struct daio *daio = &dao->daio;
189189
int i;
190190

191-
entry = kzalloc((sizeof(*entry) * daio->rscr.msr), GFP_KERNEL);
191+
entry = kcalloc(daio->rscr.msr, sizeof(*entry), GFP_KERNEL);
192192
if (!entry)
193193
return -ENOMEM;
194194

0 commit comments

Comments
 (0)