Skip to content

Commit 085c5e3

Browse files
tobluxpetrpavlu
authored andcommitted
module: Remove unnecessary size argument when calling strscpy()
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
1 parent 6380bf8 commit 085c5e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/module/main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,8 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
787787
async_synchronize_full();
788788

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

793793
free_module(mod);
794794
/* someone could wait for the module in add_unformed_module() */

0 commit comments

Comments
 (0)