* [PATCH][next] bcachefs: Use array_size() in call to copy_from_user()
@ 2023-12-19 0:26 Gustavo A. R. Silva
2023-12-19 1:29 ` Kent Overstreet
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2023-12-19 0:26 UTC (permalink / raw)
To: Kent Overstreet, Brian Foster
Cc: linux-bcachefs, linux-kernel, Gustavo A. R. Silva,
linux-hardening
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(-)
diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c
index 304ea619a888..22a52bc8406b 100644
--- a/fs/bcachefs/chardev.c
+++ b/fs/bcachefs/chardev.c
@@ -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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][next] bcachefs: Use array_size() in call to copy_from_user()
2023-12-19 0:26 [PATCH][next] bcachefs: Use array_size() in call to copy_from_user() Gustavo A. R. Silva
@ 2023-12-19 1:29 ` Kent Overstreet
0 siblings, 0 replies; 2+ messages in thread
From: Kent Overstreet @ 2023-12-19 1:29 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Brian Foster, linux-bcachefs, linux-kernel, linux-hardening
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-19 1:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-19 0:26 [PATCH][next] bcachefs: Use array_size() in call to copy_from_user() Gustavo A. R. Silva
2023-12-19 1:29 ` Kent Overstreet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox