提交 f69bf5de 编写于 作者: G Gustavo A. R. Silva 提交者: David S. Miller

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/160Signed-off-by: NGustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: NTariq Toukan <tariqt@nvidia.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 865bfb2a
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册