diff options
| author | Masahiro Yamada <[email protected]> | 2022-05-30 09:01:38 +0000 |
|---|---|---|
| committer | Masahiro Yamada <[email protected]> | 2022-06-04 21:20:57 +0000 |
| commit | 8c9ce89c5b63028dd3be43807f10b009cd2c6e51 (patch) | |
| tree | 05718b142e802d81023a13df9b75aee0dc692f83 /scripts/mod/file2alias.c | |
| parent | kbuild: factor out the common objtool arguments (diff) | |
| download | kernel-8c9ce89c5b63028dd3be43807f10b009cd2c6e51.tar.gz kernel-8c9ce89c5b63028dd3be43807f10b009cd2c6e51.zip | |
modpost: simplify mod->name allocation
mod->name is set to the ELF filename with the suffix ".o" stripped.
The current code calls strdup() and free() to manipulate the string,
but a simpler approach is to pass new_module() with the name length
subtracted by 2.
Also, check if the passed filename ends with ".o" before stripping it.
The current code blindly chops the suffix:
tmp[strlen(tmp) - 2] = '\0'
It will cause buffer under-run if strlen(tmp) < 2;
Signed-off-by: Masahiro Yamada <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
Diffstat (limited to 'scripts/mod/file2alias.c')
0 files changed, 0 insertions, 0 deletions
