diff options
author | Gustavo A. R. Silva <gustavoars@kernel.org> | 2021-09-28 23:17:33 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-09-29 13:32:14 +0300 |
commit | f69bf5dee7efdb7cbc0f3a0839989873e10cfa48 (patch) | |
tree | a06cf475aef47c7a110f324dfc5270b5d027c16a /drivers/net/ethernet/mellanox/mlx4/cq.c | |
parent | 865bfb2affa8eff5182b29aa90803a2df4409834 (diff) | |
download | linux-f69bf5dee7efdb7cbc0f3a0839989873e10cfa48.tar.xz |
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>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/cq.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/cq.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cq.c b/drivers/net/ethernet/mellanox/mlx4/cq.c index f7053a74e6a8..4d4f9cf9facb 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cq.c +++ b/drivers/net/ethernet/mellanox/mlx4/cq.c @@ -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; } |