[next] bcachefs: Use array_size() in call to copy_from_user()
Commit Message
Use array_size() helper, instead of the open-coded version in
call to copy_from_user().
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
fs/bcachefs/chardev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Mon, Dec 18, 2023 at 06:26:26PM -0600, Gustavo A. R. Silva wrote:
> Use array_size() helper, instead of the open-coded version in
> call to copy_from_user().
>
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Applied
@@ -360,7 +360,8 @@ static long bch2_ioctl_fsck_offline(struct bch_ioctl_fsck_offline __user *user_a
init_waitqueue_head(&thr->output.wait);
darray_init(&thr->output2);
- if (copy_from_user(devs, &user_arg->devs[0], sizeof(user_arg->devs[0]) * arg.nr_devs)) {
+ if (copy_from_user(devs, &user_arg->devs[0],
+ array_size(sizeof(user_arg->devs[0]), arg.nr_devs))) {
ret = -EINVAL;
goto err;
}