diff mbox series

[4/4] kbuild: error out if $(INSTALL_MOD_PATH) contains % or :

Message ID 20220714050243.16411-4-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/4] kbuild: rpm-pkg: fix build error when _arch is undefined | expand

Commit Message

Masahiro Yamada July 14, 2022, 5:02 a.m. UTC
If the directory pass given to INSTALL_MOD_PATH contains % or :,
the module_install fails.

% is used in pattern rules, and : as the separator of dependencies.

Bail out with a clearer error message.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/Makefile.modinst | 3 +++
 1 file changed, 3 insertions(+)

Comments

Nicolas Schier July 15, 2022, 9:17 a.m. UTC | #1
On Thu, Jul 14, 2022 at 02:02:43PM +0900, Masahiro Yamada wrote:
> If the directory pass given to INSTALL_MOD_PATH contains % or :,
> the module_install fails.
> 
> % is used in pattern rules, and : as the separator of dependencies.
> 
> Bail out with a clearer error message.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---

Reviewed-by: Nicolas Schier <n.schier@avm.de>
Masahiro Yamada July 16, 2022, 3:40 p.m. UTC | #2
On Thu, Jul 14, 2022 at 2:03 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> If the directory pass given to INSTALL_MOD_PATH contains % or :,

A typo.

directory pass  ->  directory path





> the module_install fails.
>
> % is used in pattern rules, and : as the separator of dependencies.
>
> Bail out with a clearer error message.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
>  scripts/Makefile.modinst | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
> index 16a02e9237d3..a4c987c23750 100644
> --- a/scripts/Makefile.modinst
> +++ b/scripts/Makefile.modinst
> @@ -18,6 +18,9 @@ INSTALL_MOD_DIR ?= extra
>  dst := $(MODLIB)/$(INSTALL_MOD_DIR)
>  endif
>
> +$(foreach x, % :, $(if $(findstring $x, $(dst)), \
> +       $(error module installation path cannot contain '$x')))
> +
>  suffix-y                               :=
>  suffix-$(CONFIG_MODULE_COMPRESS_GZIP)  := .gz
>  suffix-$(CONFIG_MODULE_COMPRESS_XZ)    := .xz
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
index 16a02e9237d3..a4c987c23750 100644
--- a/scripts/Makefile.modinst
+++ b/scripts/Makefile.modinst
@@ -18,6 +18,9 @@  INSTALL_MOD_DIR ?= extra
 dst := $(MODLIB)/$(INSTALL_MOD_DIR)
 endif
 
+$(foreach x, % :, $(if $(findstring $x, $(dst)), \
+	$(error module installation path cannot contain '$x')))
+
 suffix-y				:=
 suffix-$(CONFIG_MODULE_COMPRESS_GZIP)	:= .gz
 suffix-$(CONFIG_MODULE_COMPRESS_XZ)	:= .xz