crypto: qat - use kcalloc() instead of kzalloc()
Subsystems (2)
PATCH 1/1 crypto: qat - use kcalloc() instead of kzalloc()
We are trying to get rid of all multiplications from allocation functions to prevent integer overflows[1]. Here the multiplication is obviously safe, but using kcalloc() is more appropriate and improves readability. This patch has no effect on runtime behavior.
--- drivers/crypto/intel/qat/qat_common/adf_isr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/intel/qat/qat_common/adf_isr.c +1 -1
@@ -272,7 +272,7 @@ static int adf_isr_alloc_msix_vectors_data(struct adf_accel_dev *accel_dev)if (!accel_dev->pf.vf_info) msix_num_entries += hw_data->num_banks; - irqs =kzalloc_node (msix_num_entries *sizeof (*irqs), + irqs =kcalloc_node (msix_num_entries,sizeof (*irqs),GFP_KERNEL ,dev_to_node (&GET_DEV (accel_dev)));if (!irqs)return -ENOMEM ;
Signature · 1 line
2.43.0
Quoted 9 lines · Lenko Donchev
We are trying to get rid of all multiplications from allocation functions to prevent integer overflows[1]. Here the multiplication is obviously safe, but using
kcalloc()is more appropriate and improves readability. This patch has no effect on runtime behavior.Signed-off-by Lenko Donchev <[email protected]>
Thanks!
Signature · 1 line
Gustavo
Quoted 17 lines
--- drivers/crypto/intel/qat/qat_common/adf_isr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/crypto/intel/qat/qat_common/adf_isr.c +1
-1@@ -272,7 +272,7 @@ static int adf_isr_alloc_msix_vectors_data(struct adf_accel_dev *accel_dev)if (!accel_dev->pf.vf_info) msix_num_entries += hw_data->num_banks; - irqs =kzalloc_node (msix_num_entries *sizeof (*irqs), + irqs =kcalloc_node (msix_num_entries,sizeof (*irqs),GFP_KERNEL ,dev_to_node (&GET_DEV (accel_dev)));if (!irqs)return -ENOMEM ;
Cabiddu, Giovanni
maintainerQuoted 9 lines · Lenko Donchev
We are trying to get rid of all multiplications from allocation functions to prevent integer overflows[1]. Here the multiplication is obviously safe, but using
kcalloc()is more appropriate and improves readability. This patch has no effect on runtime behavior.Signed-off-by Lenko Donchev <[email protected]>
Thanks for your patch.
The same change was already applied to the cryptodev tree about two weeks ago. See 4da3bc65d218 ("crypto: qat - use kcalloc_node() instead of kzalloc_node()") [1].
Regards,
Signature · 1 line
Giovanni