https://github.com/torvalds/linux
Revision 8c9ce89c5b63028dd3be43807f10b009cd2c6e51 authored by Masahiro Yamada on 30 May 2022, 09:01:38 UTC, committed by Masahiro Yamada on 04 June 2022, 21:20:57 UTC
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 <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
1 parent b42d230
History
Tip revision: 8c9ce89c5b63028dd3be43807f10b009cd2c6e51 authored by Masahiro Yamada on 30 May 2022, 09:01:38 UTC
modpost: simplify mod->name allocation
Tip revision: 8c9ce89
File Mode Size
Documentation
LICENSES
arch
block
certs
crypto
drivers
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.clang-format -rw-r--r-- 16.6 KB
.cocciconfig -rw-r--r-- 59 bytes
.get_maintainer.ignore -rw-r--r-- 71 bytes
.gitattributes -rw-r--r-- 62 bytes
.gitignore -rw-r--r-- 1.9 KB
.mailmap -rw-r--r-- 22.5 KB
COPYING -rw-r--r-- 496 bytes
CREDITS -rw-r--r-- 98.9 KB
Kbuild -rw-r--r-- 1.3 KB
Kconfig -rw-r--r-- 555 bytes
MAINTAINERS -rw-r--r-- 647.3 KB
Makefile -rw-r--r-- 63.9 KB
README -rw-r--r-- 727 bytes

README

back to top