Skip to content

Commit 1a998be

Browse files
committed
kbuild: check module name conflict for external modules as well
If there are multiple modules with the same name in the same external module tree, there is ambiguity about which one will be loaded, and very likely something odd is happening. Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 3ac42b2 commit 1a998be

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1459,10 +1459,6 @@ endif
14591459
PHONY += modules
14601460
modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_check modules_prepare
14611461

1462-
PHONY += modules_check
1463-
modules_check: modules.order
1464-
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
1465-
14661462
cmd_modules_order = $(AWK) '!x[$$0]++' $(real-prereqs) > $@
14671463

14681464
modules.order: $(subdir-modorder) FORCE
@@ -1775,9 +1771,13 @@ PHONY += modules modules_install
17751771

17761772
ifdef CONFIG_MODULES
17771773

1778-
modules: $(MODORDER)
1774+
modules: modules_check
17791775
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
17801776

1777+
PHONY += modules_check
1778+
modules_check: $(MODORDER)
1779+
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
1780+
17811781
quiet_cmd_depmod = DEPMOD $(MODLIB)
17821782
cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
17831783
$(KERNELRELEASE)

scripts/modules-check.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ exit_code=0
1313
# Check uniqueness of module names
1414
check_same_name_modules()
1515
{
16-
for m in $(sed 's:.*/::' $1 | sort | uniq -d)
16+
for m in $(sed 's:.*/::' "$1" | sort | uniq -d)
1717
do
1818
echo "error: the following would cause module name conflict:" >&2
19-
sed -n "/\/$m/s:^: :p" modules.order >&2
19+
sed -n "/\/$m/s:^: :p" "$1" >&2
2020
exit_code=1
2121
done
2222
}

0 commit comments

Comments
 (0)