2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-28 23:23:55 +08:00

net/mlx4: Use array_size() helper in copy_to_user()

Use array_size() helper instead of the open-coded version in
copy_to_user(). These sorts of multiplication factors need
to be wrapped in array_size().

Link: https://github.com/KSPP/linux/issues/160
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Gustavo A. R. Silva 2021-09-28 15:17:33 -05:00 committed by David S. Miller
parent 865bfb2aff
commit f69bf5dee7

View File

@ -314,7 +314,8 @@ static int mlx4_init_user_cqes(void *buf, int entries, int cqe_size)
buf += PAGE_SIZE;
}
} else {
err = copy_to_user((void __user *)buf, init_ents, entries * cqe_size) ?
err = copy_to_user((void __user *)buf, init_ents,
array_size(entries, cqe_size)) ?
-EFAULT : 0;
}