All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>
Subject: [PATCH 4/9] kbuild: check module name conflict for external modules as well
Date: Wed, 31 Mar 2021 22:38:05 +0900	[thread overview]
Message-ID: <20210331133811.3221540-4-masahiroy@kernel.org> (raw)
In-Reply-To: <20210331133811.3221540-1-masahiroy@kernel.org>

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 <masahiroy@kernel.org>
---

 Makefile                 | 10 +++++-----
 scripts/modules-check.sh |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index a6f73335757d..b5ff4753eba8 100644
--- a/Makefile
+++ b/Makefile
@@ -1459,10 +1459,6 @@ endif
 PHONY += modules
 modules: $(if $(KBUILD_BUILTIN),vmlinux) modules_check modules_prepare
 
-PHONY += modules_check
-modules_check: modules.order
-	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
-
 cmd_modules_order = $(AWK) '!x[$$0]++' $(real-prereqs) > $@
 
 modules.order: $(subdir-modorder) FORCE
@@ -1775,9 +1771,13 @@ PHONY += modules modules_install
 
 ifdef CONFIG_MODULES
 
-modules: $(MODORDER)
+modules: modules_check
 	$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
 
+PHONY += modules_check
+modules_check: $(MODORDER)
+	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/modules-check.sh $<
+
 quiet_cmd_depmod = DEPMOD  $(MODLIB)
       cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
                    $(KERNELRELEASE)
diff --git a/scripts/modules-check.sh b/scripts/modules-check.sh
index 43de226071ae..e06327722263 100755
--- a/scripts/modules-check.sh
+++ b/scripts/modules-check.sh
@@ -13,10 +13,10 @@ exit_code=0
 # Check uniqueness of module names
 check_same_name_modules()
 {
-	for m in $(sed 's:.*/::' $1 | sort | uniq -d)
+	for m in $(sed 's:.*/::' "$1" | sort | uniq -d)
 	do
 		echo "error: the following would cause module name conflict:" >&2
-		sed -n "/\/$m/s:^:  :p" modules.order >&2
+		sed -n "/\/$m/s:^:  :p" "$1" >&2
 		exit_code=1
 	done
 }
-- 
2.27.0


  parent reply	other threads:[~2021-03-31 13:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31 13:38 [PATCH 1/9] kbuild: remove unneeded mkdir for external modules_install Masahiro Yamada
2021-03-31 13:38 ` [PATCH 2/9] kbuild: unify modules(_install) for in-tree and external modules Masahiro Yamada
2021-03-31 13:38 ` [PATCH 3/9] kbuild: show the target directory for depmod log Masahiro Yamada
2021-03-31 13:38 ` Masahiro Yamada [this message]
2021-03-31 13:38 ` [PATCH 5/9] kbuild: rename extmod-prefix to extmod_prefix Masahiro Yamada
2021-03-31 17:54   ` Nick Desaulniers
2021-03-31 13:38 ` [PATCH 6/9] kbuild: refactor scripts/Makefile.modinst Masahiro Yamada
2021-05-12 14:23   ` Johannes Berg
2021-03-31 13:38 ` [PATCH 7/9] kbuild: move module strip/compression code into scripts/Makefile.modinst Masahiro Yamada
2021-03-31 13:38 ` [PATCH 8/9] kbuild: merge scripts/Makefile.modsign to scripts/Makefile.modinst Masahiro Yamada
2021-03-31 13:38 ` [PATCH 9/9] kbuild: remove CONFIG_MODULE_COMPRESS Masahiro Yamada
2021-03-31 18:01   ` Nick Desaulniers
2021-04-07 14:29   ` Masahiro Yamada
2021-04-07 14:30 ` [PATCH 1/9] kbuild: remove unneeded mkdir for external modules_install Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210331133811.3221540-4-masahiroy@kernel.org \
    --to=masahiroy@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.