Commit d7ca9a34 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Jakub Kicinski

net: hinic: Use devm_kcalloc() instead of devm_kzalloc()

Use 2-factor multiplication argument form devm_kcalloc() instead
of devm_kzalloc().

Link: https://github.com/KSPP/linux/issues/162Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20211208003527.GA75483@embeddedorSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 28a0a044
...@@ -375,31 +375,30 @@ int hinic_io_create_qps(struct hinic_func_to_io *func_to_io, ...@@ -375,31 +375,30 @@ int hinic_io_create_qps(struct hinic_func_to_io *func_to_io,
{ {
struct hinic_hwif *hwif = func_to_io->hwif; struct hinic_hwif *hwif = func_to_io->hwif;
struct pci_dev *pdev = hwif->pdev; struct pci_dev *pdev = hwif->pdev;
size_t qps_size, wq_size, db_size;
void *ci_addr_base; void *ci_addr_base;
int i, j, err; int i, j, err;
qps_size = num_qps * sizeof(*func_to_io->qps); func_to_io->qps = devm_kcalloc(&pdev->dev, num_qps,
func_to_io->qps = devm_kzalloc(&pdev->dev, qps_size, GFP_KERNEL); sizeof(*func_to_io->qps), GFP_KERNEL);
if (!func_to_io->qps) if (!func_to_io->qps)
return -ENOMEM; return -ENOMEM;
wq_size = num_qps * sizeof(*func_to_io->sq_wq); func_to_io->sq_wq = devm_kcalloc(&pdev->dev, num_qps,
func_to_io->sq_wq = devm_kzalloc(&pdev->dev, wq_size, GFP_KERNEL); sizeof(*func_to_io->sq_wq), GFP_KERNEL);
if (!func_to_io->sq_wq) { if (!func_to_io->sq_wq) {
err = -ENOMEM; err = -ENOMEM;
goto err_sq_wq; goto err_sq_wq;
} }
wq_size = num_qps * sizeof(*func_to_io->rq_wq); func_to_io->rq_wq = devm_kcalloc(&pdev->dev, num_qps,
func_to_io->rq_wq = devm_kzalloc(&pdev->dev, wq_size, GFP_KERNEL); sizeof(*func_to_io->rq_wq), GFP_KERNEL);
if (!func_to_io->rq_wq) { if (!func_to_io->rq_wq) {
err = -ENOMEM; err = -ENOMEM;
goto err_rq_wq; goto err_rq_wq;
} }
db_size = num_qps * sizeof(*func_to_io->sq_db); func_to_io->sq_db = devm_kcalloc(&pdev->dev, num_qps,
func_to_io->sq_db = devm_kzalloc(&pdev->dev, db_size, GFP_KERNEL); sizeof(*func_to_io->sq_db), GFP_KERNEL);
if (!func_to_io->sq_db) { if (!func_to_io->sq_db) {
err = -ENOMEM; err = -ENOMEM;
goto err_sq_db; goto err_sq_db;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment