bcachefs: Use array_size() in call to copy_from_user()
PATCH 1/1 bcachefs: Use array_size() in call to copy_from_user()
Use array_size() helper, instead of the open-coded version in call to copy_from_user().
Signed-off-by Gustavo A. R. Silva <[email protected]>
--- fs/bcachefs/chardev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/bcachefs/chardev.c +2 -1
@@ -360,7 +360,8 @@ static long bch2_ioctl_fsck_offline(struct bch_ioctl_fsck_offline __user *user_ainit_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; }
Signature · 1 line
2.34.1
Kent Overstreet
AppliedQuoted 4 lines · Gustavo A. R. Silva
Use
array_size()helper, instead of the open-coded version in call tocopy_from_user().Signed-off-by Gustavo A. R. Silva <[email protected]>
Applied