Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: artpec6 - change from kzalloc to kcalloc in artpec6_crypto_probe()

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: https://github.com/KSPP/linux/issues/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 <ethan@ethancedwards.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Ethan Carter Edwards and committed by
Herbert Xu
01894c84 37d45180

+2 -2
+2 -2
drivers/crypto/axis/artpec6_crypto.c
··· 2897 2897 tasklet_init(&ac->task, artpec6_crypto_task, 2898 2898 (unsigned long)ac); 2899 2899 2900 - ac->pad_buffer = devm_kzalloc(&pdev->dev, 2 * ARTPEC_CACHE_LINE_MAX, 2900 + ac->pad_buffer = devm_kcalloc(&pdev->dev, 2, ARTPEC_CACHE_LINE_MAX, 2901 2901 GFP_KERNEL); 2902 2902 if (!ac->pad_buffer) 2903 2903 return -ENOMEM; 2904 2904 ac->pad_buffer = PTR_ALIGN(ac->pad_buffer, ARTPEC_CACHE_LINE_MAX); 2905 2905 2906 - ac->zero_buffer = devm_kzalloc(&pdev->dev, 2 * ARTPEC_CACHE_LINE_MAX, 2906 + ac->zero_buffer = devm_kcalloc(&pdev->dev, 2, ARTPEC_CACHE_LINE_MAX, 2907 2907 GFP_KERNEL); 2908 2908 if (!ac->zero_buffer) 2909 2909 return -ENOMEM;