1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:28:12 +00:00

Kernel/Syscalls: Use copy_n_to_user when applicable

copy_to_user() with bytes as the last argument could be changed to using
copy_n_to_user() with a count.
This commit is contained in:
Pankaj Raghav 2023-03-24 09:59:28 +01:00 committed by Andreas Kling
parent f32fde6152
commit d0ac24ddbf
5 changed files with 10 additions and 9 deletions

View file

@ -83,7 +83,7 @@ ErrorOr<FlatPtr> Process::sys$getgroups(size_t count, Userspace<GroupID*> user_g
return credentials->extra_gids().size();
if (count != credentials->extra_gids().size())
return EINVAL;
TRY(copy_to_user(user_gids, credentials->extra_gids().data(), sizeof(GroupID) * count));
TRY(copy_n_to_user(user_gids, credentials->extra_gids().data(), count));
return 0;
}