Skip to content

Commit

Permalink
module: Remove unnecessary size argument when calling strscpy()
Browse files Browse the repository at this point in the history
The size parameter is optional and strscpy() automatically determines
the length of the destination buffer using sizeof() if the argument is
omitted. This makes the explicit sizeof() unnecessary. Remove it to
shorten and simplify the code.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250308194631.191670-2-thorsten.blum@linux.dev
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
  • Loading branch information
Thorsten Blum authored and Petr Pavlu committed Mar 10, 2025
1 parent 6380bf8 commit 085c5e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/module/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,8 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
async_synchronize_full();

/* Store the name and taints of the last unloaded module for diagnostic purposes */
strscpy(last_unloaded_module.name, mod->name, sizeof(last_unloaded_module.name));
strscpy(last_unloaded_module.taints, module_flags(mod, buf, false), sizeof(last_unloaded_module.taints));
strscpy(last_unloaded_module.name, mod->name);
strscpy(last_unloaded_module.taints, module_flags(mod, buf, false));

free_module(mod);
/* someone could wait for the module in add_unformed_module() */
Expand Down

0 comments on commit 085c5e3

Please sign in to comment.